Open
Conversation
Contributor
|
Nice work! Could you add ch643 to CI test matrix? |
Author
Thanks for the review! I've added ch643 to the CI test matrix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds initial support for the WCH CH643 series.
Dependency Note:
This PR relies on ch32-rs/ch32-data#23 (adds missing
PIOCinterrupt).Since
ch32-metapacis generated fromch32-data, I verified this by locally generating the metapac with the patched data. This PR does not include those generated files; it's ready to merge once upstreamch32-datais updated and released.Changes
x0RCC implementation.src/exti.rs.ch643feature inCargo.tomland updated documentation.examples/ch643: basic blinky, embassy (async/clock tree), PWM, and ADC.Hardware Verification
All tests were performed on a CH643 development board using wlink for flashing and SDI logging.
Blinky
$ cargo +nightly run --release --bin blinky ...... Finished `release` profile [optimized] target(s) in 0.34s Running `wlink flash --enable-sdi-print --watch-serial target/riscv32imc-unknown-none-elf/release/blinky` 11:39:50 [INFO] Connected to WCH-Link v2.14(v34) (WCH-LinkE-CH32V305) 11:39:50 [INFO] Attached chip: CH643 (ChipID: 0x64310621) 11:39:50 [INFO] Chip ESIG: FlashSize(62KB) UID(cd-ab-be-d5-4d-bc-d8-3d) 11:39:50 [INFO] Flash protected: false 11:39:50 [INFO] Read target/riscv32imc-unknown-none-elf/release/blinky as ELF format 11:39:50 [INFO] Flashing 5692 bytes to 0x08000000 █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 5692/569211:39:50 [INFO] Flash done 11:39:51 [INFO] Now reset... 11:39:51 [INFO] Now connect to the WCH-Link serial port to read SDI print 2026-01-22 19:39:51.958: toggle! 2026-01-22 19:39:51.959: systick: 4000012 2026-01-22 19:39:52.460: toggle! 2026-01-22 19:39:52.461: systick: 4000013 2026-01-22 19:39:52.962: toggle! 2026-01-22 19:39:52.963: systick: 4000016 2026-01-22 19:39:53.464: toggle! 2026-01-22 19:39:53.465: systick: 4000013 2026-01-22 19:39:53.966: toggle! 2026-01-22 19:39:53.967: systick: 4000016Embassy Blinky
$ cargo +nightly run --release --bin embassy_blinky ...... Finished `release` profile [optimized] target(s) in 0.47s Running `wlink flash --enable-sdi-print --watch-serial target/riscv32imc-unknown-none-elf/release/embassy_blinky` 11:42:48 [INFO] Connected to WCH-Link v2.14(v34) (WCH-LinkE-CH32V305) 11:42:48 [INFO] Attached chip: CH643 (ChipID: 0x64310621) 11:42:48 [INFO] Chip ESIG: FlashSize(62KB) UID(cd-ab-be-d5-4d-bc-d8-3d) 11:42:48 [INFO] Flash protected: false 11:42:48 [INFO] Read target/riscv32imc-unknown-none-elf/release/embassy_blinky as ELF format 11:42:48 [INFO] Flashing 14240 bytes to 0x08000000 ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 14240/1424011:42:49 [INFO] Flash done 11:42:49 [INFO] Now reset... 11:42:49 [INFO] Now connect to the WCH-Link serial port to read SDI print 2026-01-22 19:42:49.864: 0), hclk: Hertz(48000000), pclk1: Hertz(48000000), pclk2: Hertz(48000000), pclk1_tim: Hertz(48000000), pclk2_tim: Hertz(48000000) } 2026-01-22 19:42:50.881: tick 2026-01-22 19:42:51.882: tick 2026-01-22 19:42:52.883: tickPWM
$ cargo +nightly run --release --bin pwm ...... Finished `release` profile [optimized] target(s) in 0.06s Running `wlink flash --enable-sdi-print --watch-serial target/riscv32imc-unknown-none-elf/release/pwm` 11:45:18 [INFO] Connected to WCH-Link v2.14(v34) (WCH-LinkE-CH32V305) 11:45:18 [INFO] Attached chip: CH643 (ChipID: 0x64310621) 11:45:18 [INFO] Chip ESIG: FlashSize(62KB) UID(cd-ab-be-d5-4d-bc-d8-3d) 11:45:18 [INFO] Flash protected: false 11:45:18 [INFO] Read target/riscv32imc-unknown-none-elf/release/pwm as ELF format 11:45:18 [INFO] Flashing 2616 bytes to 0x08000000 █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 2616/261611:45:18 [INFO] Flash done 11:45:19 [INFO] Now reset... 11:45:19 [INFO] Now connect to the WCH-Link serial port to read SDI printADC
$ cargo +nightly run --release --bin adc ...... Finished `release` profile [optimized] target(s) in 0.08s Running `wlink flash --enable-sdi-print --watch-serial target/riscv32imc-unknown-none-elf/release/adc` 12:04:40 [INFO] Connected to WCH-Link v2.14(v34) (WCH-LinkE-CH32V305) 12:04:40 [INFO] Attached chip: CH643 (ChipID: 0x64310621) 12:04:40 [INFO] Chip ESIG: FlashSize(62KB) UID(cd-ab-be-d5-4d-bc-d8-3d) 12:04:40 [INFO] Flash protected: false 12:04:40 [INFO] Read target/riscv32imc-unknown-none-elf/release/adc as ELF format 12:04:40 [INFO] Flashing 4624 bytes to 0x08000000 █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 4624/462412:04:41 [INFO] Flash done 12:04:41 [INFO] Now reset... 12:04:41 [INFO] Now connect to the WCH-Link serial port to read SDI print 2026-01-22 20:04:42.524: adc: 1223 2026-01-22 20:04:43.526: adc: 1247 2026-01-22 20:04:44.527: adc: 1248 2026-01-22 20:04:45.528: adc: 1243 2026-01-22 20:04:46.529: adc: 2451 2026-01-22 20:04:47.531: adc: 2467 2026-01-22 20:04:48.532: adc: 2467 2026-01-22 20:04:49.533: adc: 1233 2026-01-22 20:04:50.533: adc: 2448 2026-01-22 20:04:51.534: adc: 2467 2026-01-22 20:04:52.535: adc: 1231 2026-01-22 20:04:53.537: adc: 1247