Serial flashing method - RoboDurden/Hoverboard-Firmware-Hack-Gen2.x GitHub Wiki
[!CAUTION] Warning! Using serial flashing requires doing micro soldering to the pin(s) of gd32, please use the SWD flashing method if you are not comfortable doing it!)
Usage
In the following cases, you might want to use serial for flashing your board:
- The SWD GPIO (PA13 PA14) is used as a GPIO, thus SWD is disabled
- You do not have a STlink V2 or any compatible SWD debug probe
- You want to use STM32 Cube Programmer
- Flash unlock fails
Wiring
T1he gd32/stm32/mm32 bootloader is activated by pulling BOOT0 HIGH and BOOT1 LOW
The Serial pin in bootloader mode is different from the normal ones (pa9 TX pa10 RX)
GPIO | Description | wiring |
---|---|---|
BOOT0 | -- | connect to 3.3V |
PB2 | BOOT1 | connect to GND with 1K resistor |
PA9 | TX | RX |
PA10 | RX | TX |
VCC | 3.3V | |
GND | GND |
- On most board, the BOOT0 is directly soldered to GND pad, so you will have to lift the pin up with a sharp tool while heating it
- BOOT0 can be directly connected to 3.3v afterwards, just make sure there is no short circuit to GND from the pad it originally connect to
- BOOT1 must be pulled LOW through a 1K resistor, because it is used as a normal GPIO, if you hard pull it to GND it can cause a short circuit in the micro controller and destroy it, and if you use too high value it can get dragged by the load to HIGH
- TX and RX is PA9 PA10 which is always used by the motor blue and green phase, so you can solder the line to the gate driver ic they will not interfere with the signal and makes a larger solder pad to work with
- It is important never connect the battery when serial line is connected, because you can create a short circuit with the mosfets, power the board from CP2102 internal 3.3v source is enough (100ma)
- Make sure the usb to serial adapter is 3.3v not 5v(and also not +-15v!), or at least have a series resistor, otherwise it will not work I tried
video toturial of soldering: https://youtu.be/rUMzHYvKoW4
Example
The example soldering job is definitely not the best but it did work
Flashing
- Download STM32 Cube Programmer from official website or fileCR
- Select UART
- Plug in your board with usb to serial adapter
- Select your com port, 115200 baud, Even parity
- Click connect
- The flash should be read and if lock it will be unlocked automatically
-
Click open file and choose the hex file, then press download
-
After a while it should say download complete
Aftermath
After flashing, BOOT0 need to be connected to GND to boot normally again, or it will always boot to bootloader
GD32E230
connecting to GD32 boards might work better with free "GD32 All In One Programmer" from https://www.gd32mcu.com/en/download/7
GD32E230 does not need nor have a Boot1 pin. To disconnect Boot0 from GND, gently pull the mcu pin upwards while heating the pin.
Fix the thin wires with a small piece of heat-gun glue that you put in place with a twezzer and melt with the soldering iron..
Beware that the SOT8 mosfet drivers have different pinouts. Check with multimeter diode-tester from PA9/PA10 to the (1 kOhm) resistors of the SOT8 inputs.
Glue another female dupont header to the 4pin flash header that you solder the thin wires to:
Warning: Gen2.3.3 seems to have a permanent lock from hoverboard manufacturer that can not be unlocked at all - you need to replace with a new GD32E230C8T6 (a GD32F130C8T6 might also work (only pin 1 has different usage VDD / VBAT)