Giter VIP home page Giter VIP logo

ch58x-hal's Introduction

ch32-rs - WCH's CH32 Peripheral Access Crates

crates.io crates.io crates.io crates.io crates.io crates.io

crates.io crates.io crates.io crates.io crates.io crates.io


Embedded Rust device crates for WCH's RISC-V and Cortex-M(planned) microcontrollers.

Note This project is not affiliated with WCH. This is a hobby project.

Alternatives to PAC crates

The ch32-rs team also working on a unified "metapac" solution for all WCH's MCUs, using metadata to generate an "all-in-one" PAC crate. It's still in early stage, but you can check it out at ch32-rs/ch32-data and ch32-rs/ch32-metapac.

Notes on License

The original SVD files were distributed with MounRiver IDE without explicit license information. These files have been extensively modified and corrected for use in this project. If you believe this project violates any licensing terms or if you have any concerns, please contact the project maintainers immediately.

If you are planing to use these SVD files in another product, please contact WCH for license information.

To handle the license issue, ch32-data is created. The data in ch32-data has been manually created and curated, referencing the original SVD files and official datasheets but incorporating significant modifications and corrections. And, the most important, ch32-data is released under the MIT license.

HAL crates

  • ch58x-hal - embassy, gpio, spi, i2c, ble
  • ch32x0-hal - embassy, gpio
  • ch59x-hal - early stage, ch58x-hal can be used with very minor changes
  • ch57x-hal - planning, ch58x-hal can be used with very minor changes
  • ch32v00x-hal - early stage, requires nightly rust for RV32EC support
  • ch32-hal - wip unified hal for all WCH's MCUs

Runtime Support

Roadmap

Development

# Do not use rust version of svdtools
pip install svdtools

# install xmlint

cargo install svd2rust

./scripts/generate.sh && ./scripts/update.sh

MCU list

NOTE: Will never support 8-bit MCUs.

RISC-V

Nick name: "赤菟"(Chitu). IP Core brand: 青稞(Qingke). V2A, V3A, V4A, V4B, V4C, V4F.

  • CH32V003: Qingke-V2A
  • CH32V103: Qingke-V3A
  • CH32V203: Qingke-V4B
  • CH32V208: Qingke-V4C, BLE
  • CH32V30x: Qingke-V4F
  • CH32L103 Qingke-V4C, Low power
  • CH32X03x: Qingke-V4C, USB PD, PIOC
  • CH56x: Qingke-V3A, USB 3.0 SS
  • CH571, CH573: Qingke-V3A, BLE 4.2
  • CH58x: Qingke-V4A, BLE 5.3
  • CH59x: Qingke-V4C, BLE 5.4
  • CH641: Qingke-V2A, USB PD
  • CH643: Qingke-V4C RGB/LED/PWM, PIOC, USB PD
  • CH645: Qingke-V4C, USB PD + USB HS

Cortex-M

CH32F uses Cortex-M3. CH577/CH578/CH579 uses Cortex-M0.

  • CH32F103
  • CH32F203
  • CH32F205
  • CH32F207
  • CH32F208, BLE 5.3
  • CH577/CH578/CH579, BLE 4.2

Toolchain

Ref

ch58x-hal's People

Contributors

andelf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ch58x-hal's Issues

Feature request: Is IR transmitter possible with ch582F chip in Rust?

As you know I am very new to Rust language. With your help I just setup Rust environment couple of days ago.

Now I have new feature request. I was searching for IR transmitter solution for CH582F in Rust but could not find any. But came across a repository which implements IR transmitter for ATTiny13A micro controller and goes into detail of it's functionality. I think he uses timer functionality of ATTiny13A to create any custom IR protocol codes. The repository is linked below:

https://github.com/wagiminator/ATtiny13-TinyRemote?tab=readme-ov-file

He also have IR receiver implemented on ATTiny13A chip in another repository:

https://github.com/wagiminator/ATtiny13-TinyDecoder

His blog linked below is treasure trove for ATTiny devices:

http://www.technoblogy.com/show?24A9

One benefit of CH582F is it's builtin BLE. This makes it possible to use smartphone instead of buttons in above project to control any device in vicinity of IR transmitter. That can make very low cost home automation system.

Is it possible to implement this in Rust?

Thank you.

Timer interrupts

Hey there, first of all thanks for your awesome work!

I have a short question: I'm currently writing firmware to control an LED matrix which requires a function to be called quite regularly, is it possible to use timer interrupts using your HAL to call my display-function? Couldn't really find an example for that and my rust knowledge seems to be not good enough to fully understand the HAL source.

Thanks in advance!

state of this crate?

hello! I want to use the crate for an experimental project, but not sure the state of the crate. I'm wondering is there a roadmap for this crate, so that everyone can know the current state of this project?

Portability

Is it possible to make this HAL library compatible with both CH57x (RISC-V), CH58x and CH59x?
My idea is to use different implementations for different MCUs on the lower layer, but provide the same interface to the user on the upper layer, and the user selects the MCU they use through Rust features.

Serial over USB?

FIrst of all, I'm extremely new to MCU programming so sorry if I'm asking something stupid.

Is it possible to get the debug output over USB? Via serial, uart, I don't know. I have a CH582M in one of the dev boards with the type-c, and I've been trying to get the debug output, but it hasn't been working for me. May be a drivers thing (I'm using Windows 10), but the computer can't recognize the device when it's actually running the code, so the "serial" and "uart-echo" examples don't do much for me.

Thanks!

Wrong delay on blinky example

After trying the blinky and yd-ch582m examples on a YD-CH582M core board, the delay does not work as expected. It's about ~100 times too long, setting delay_ms to 10 gives a ~1s blink (I haven't measured exactly).

Maybe the clock setup is not correct?

I'm using wchisp as a runner/flasher.

Questions regarding CH582F chip

I am new to rust language. I have some questions regarding using CH582F chip.

I want to make an IOT project where I want to read 3 ADC pins every 5 minutes to read temperature, light level and battery level and then broadcast it using BLE (preferably coded phy 125kb for longer range). After broadcasting the chip should go to sleep for 5 minutes to conserve battery power.

Is this possible with current code in your repository?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.