Fix ch32v103 hardfault & Add CH32V103C8T6 Bluepill board#3620
Fix ch32v103 hardfault & Add CH32V103C8T6 Bluepill board#3620UMRnInside wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets the CH32V103 BSP startup/hardfault issue by avoiding the vendor __disable_irq()/__enable_irq() implementation that traps when executed in U-mode, and it adds a new CH32V103C8T6 “Bluepill” board definition with appropriate flash/RAM linker sizing.
Changes:
- Avoids calling
__disable_irq()/__enable_irq()inhw/bsp/ch32v10x/family.cto prevent hardfaults on CH32V103 EVT when running in U-mode. - Adds a new
ch32v103c_bluepillboard (pins + build/linker settings). - Enables
CFG_EXAMPLE_MSC_DUAL_READONLYfor the new board (matching the existing CH32V103R board setup).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| hw/bsp/ch32v10x/family.c | Skips global IRQ disable/enable in board_init() to avoid U-mode hardfault. |
| hw/bsp/ch32v10x/boards/ch32v103c_bluepill/board.mk | Sets CFG_EXAMPLE_MSC_DUAL_READONLY and defines flash/RAM sizes for the linker. |
| hw/bsp/ch32v10x/boards/ch32v103c_bluepill/board.h | Adds LED/button pin mappings and board metadata for the Bluepill variant. |
| hw/bsp/ch32v10x/boards/ch32v103c_bluepill/board.cmake | Mirrors board.mk settings for CMake builds (flash/RAM + compile definitions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chinese -> Chinese manufactors -> manufacturers Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Thank you, I've just fixed some CH32's DCD reliability issue, could you test again ? |
|
Tested, I got device descriptor read error -110. MCU output with LOG=2: And dmesg: |


#2674 has a startup issue in
board_init():__disable_irq()from CH32V103 EVT callscsrc mstatus, 0x88in U-mode (which is only allowed in M-mode)https://github.com/openwch/ch32v103/blob/f99a84c4c42b6fb676560a9b8b7c737401efe0ad/EVT/EXAM/SRC/Core/core_riscv.h#L144-L155
__disable_irq()in CH32V307 EVT (probably also in CH32V203), however, uses vendor-defined CSR 0x800. This CSR is writable in U-mode, according to QingKeV3 Processor Manual:https://github.com/openwch/ch32v307/blob/7e33c66cd91008054d2a37db534b10162d1f0c6e/EVT/EXAM/SRC/Core/core_riscv.h#L141-L145
Now you can see the LED blinking, log outputting from UART(if
LOG=2), but cdc_msc example is still not working.