This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
WCH RVSWD protocol
fxsheep edited this page Feb 26, 2022
·
7 revisions
RVSWD
is the name of the proprietary two-wire debug interface on WCH's RISC-V MCU. Similar to ARM's SWD
interface, RWSWD
has two wires named SWDIO
and SWCLK
respectively, but the protocol is not compatible.
This protocol has some characteristics of I2C. Specifically:
-
SWCLK
andSWDIO
are high when there's no transaction. -
SWDIO
changing to low whileSWCLK
is high marks a START condition. -
SWDIO
changing to high whileSWCLK
is high marks a STOP condition. -
SWDIO
should change only whenSWCLK
is low during transaction. - When
SWCLK
is high, a bit is interpreted as 1 ifSWDIO
is high, interpreted as 0 ifSWDIO
is low.
A transaction is always initiated by the host(WCH-Link). The protocol is point-to-point, thus there's no slave address. There's no ACK/NACK either.
Type | START | Address | Data | Operation | Parity? | Address | Data | Operation | Parity? | STOP |
---|---|---|---|---|---|---|---|---|---|---|
From | Host | Host | Host | Host | Host | Target | Target | Target | Target | Host |
Length(bit) | - | 7 | 32 | 2 | 1 | 7 | 32 | 2 | 1 | - |
Note:
- Address and data are the ones in RISC-V Debug Module.
- Operation: 0:NOP 1:read 2:write.
- All
address
anddata
are MSB first. - Data field of read request sent from host is (always?) 0.