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

Minor doc update for ChipUID command response #58

Closed cw2 closed 4 months ago

cw2 commented 4 months ago
// This does not use standard response format:
// raw response: ffff00 20 aeb4abcd 16c6bc45 e339e339e339e339
// UID in wchisp: cd-ab-b4-ae-45-bc-c6-16
// e339e339e339e339 => inital value of erased flash
/// Chip UID, also reported by wchisp

For CH32V micros (and maybe also other variants) the first four response bytes FFFF0020 is actually contents of "Flash Capacity Register" - ignore leading FFFF, because the register is 16 bits only and contains flash size in KB, i.e. 0x20 = 32 KB.

I think the response is in fact just dump of the whole Electronic Signature info, as described for example in the CH32V003 Reference Manual Chapter 15 Electronic Signature (ESIG).