Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serial transport #56

Merged
merged 20 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ object = { version = "0.36.0", default-features = false, features = [
"std",
] }
indicatif = "0.17"
serialport = { version = "4.5", default-features = false }
74 changes: 70 additions & 4 deletions devices/0x21-CH32V00x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,75 @@ support_usb: false
support_serial: true
description: CH32V00x (RISC-V2A) Series
config_registers:
# Ref: section "16.5 User Option Bytes" of RM manual
- offset: 0x00
name: RDPR_USER
description: RDPR, nRDPR, USER, nUSER
reset: 0x08F75AA5
type: u32
fields:
- bit_range: [7, 0]
name: RDPR
description: Read Protection. 0xA5 for unprotected, otherwise read-protected (ignoring WRP)
explaination:
0xa5: Unprotected
_: Protected
- bit_range: [16, 16]
name: IWDG_SW
description: Independent watchdog (IWDG) hardware enable
explaination:
1: IWDG enabled by software, and not enabled by hardware
0: IWDG enabled by hardware (along with the LSI clock)
- bit_range: [18, 18]
name: STANDBY_RST
description: System reset control under the standby mode
explaination:
1: Disabled, entering standby-mode without RST
0: Enabled
- bit_range: [20, 19]
name: RST_MODE
description: External pin PD7 reset mode
explaination:
0b00: Ignoring pin states within 128us after turning on the multiplexing function
0b01: Ignoring pin states within 1ms after turning on the multiplexing function
0b10: Ignoring pin states within 12ms after turning on the multiplexing function
0b11: Multiplexing function off, PD7 for I/O function
- bit_range: [21, 21]
name: START_MODE
description: Power-on startup mode
explaination:
1: Start from BOOT area
0: Start from user CODE area
- offset: 0x04
name: DATA
description: Customizable 2 byte data, DATA0, nDATA0, DATA1, nDATA1
reset: 0xFF00FF00
type: u32
fields:
- bit_range: [7, 0]
name: DATA0
- bit_range: [23, 16]
name: DATA1
- offset: 0x08
name: WRPR
# Each bit is used to control the write-protect status of 1 sector (1K bytes/sector)
description: Flash memory write protection status
type: u32
reset: 0xFFFFFFFF
explaination:
0xFFFFFFFF: Unprotected
_: Some 1K sections are protected
variants:
- name: CH32V003*4*6
chip_id: 51
alt_chip_ids: [50, 49, 48]
- name: CH32V003F4P6
chip_id: 0x30
flash_size: 16K

- name: CH32V003F4U6
chip_id: 0x31
flash_size: 16K
- name: CH32V003A4M6
chip_id: 0x32
flash_size: 16K
- name: CH32V003J4M6
chip_id: 0x33
flash_size: 16K
# TODO: add CH32V002, 004 & 006 - chip IDs unknown at present
Loading