MarsTechHAN / ch552tool

An open sourced python tool for flashing WCH CH55x series USB microcontroller with bootloader v2.30, v2.31 & v2.40.
GNU General Public License v3.0
158 stars 24 forks source link

Document how to put the chip in DFU mode #8

Closed zoobab closed 4 years ago

zoobab commented 4 years ago

Hi,

I have just flashed a blink.c with the ch552tool, if I try to flash it again it does not find the device in lsusb with a NO_DEV_FOUND error.

Any idea how to get the chip in bootloader mode? Do I have to wire a RST pin to GND?

nerdralph commented 4 years ago

The bootloader is only run after POR. Other reset sources do not trigger the bootloader. And external reset is active high, not low like most other types of MCUs. I've considered using an external pin to trigger an interrupt which jumps to the bootloader (0x3800). The technique used by ch55xduino is similar to the arduino micro; when the CDC device detects the baud rate changed to 1200bps, it jumps to the bootloader. Another idea is to implement a minimal USB control endpoint with the WCH DFU VID:PID, and when it gets a device reset command, jump to the bootloader. To trigger the reset, you can use usbreset https://github.com/jkulesza/usbreset

MarsTechHAN commented 4 years ago

I think @nerdralph gives a pretty good explanation here, since this is not a bug or feature can be added to the program itself, I will close the issue.