ch32-rs / wlink

An open source WCH-Link library/command line tool written in Rust.
Apache License 2.0
155 stars 25 forks source link

Disable Flash Protection not working? #46

Closed smaharj1 closed 6 months ago

smaharj1 commented 6 months ago

I am pretty new to this, but connected to the CH32X035 through WCH-LinkE and tried the following command to unprotect the flash wlink unprotect

I get the following message:

wlink unprotect
22:51:20 [INFO] Connected to WCH-Link v2.11(v31) (WCH-LinkE-CH32V305)
22:51:20 [INFO] Attached chip: CH32X035 [CH32X035G8U6] (ChipID: 0x03560601)
22:51:20 [INFO] Unprotect Flash
22:51:20 [INFO] Flash protected: true

Am I missing something? My main goal is to try to disable Read Protection.

andelf commented 6 months ago

This should be fixed. Could you check the newest changeset? CH32X035 works. As I'm developing the https://github.com/ch32-rs/ch32x0-hal with this.

smaharj1 commented 6 months ago

Nice. I do not have access to the github link you posted, but getting the latest from the nightly release worked. Weird thing was both the nightly release version and standard cargo's wlink version are the same.

andelf commented 6 months ago

@smaharj1 nightly is triggered periodically or manually. I need to test on other MCUs, then do a cargo release.

After digging into the underlying flash protection mechanism, I discovered that four commands are used for protecting/unprotecting, with 2 commands each.