Skip to content

Flash the firmware on 850C using SWD

casainho edited this page Nov 14, 2019 · 2 revisions

Please follow the next steps to be able to flash the firmware.

Table of Contents

WARNING: There is no way to backup the original bootloader and firmware. Once you erase, both original bootloader and firmware you will erased forever.

Download the firmware binary file (Bafang_LCD_850C_firmware-for_bootloader-vxxx) from here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases

How to open the LCD

  1. use something thin to force open the front cover, by making force on the sides of the case
  2. remove the hard plastic layer that is on top of the LCD
  3. remove the 2 little screws that fix the LCD and the board to the case

Flash the firmware

Buy STLinkV2 clone

To be able to flash the firmware (both for TSDZ2 motor controller and display), you will need the cheap clone of STLinkV2, that you can buy on EBay as cheap as 2€.

WARNING: we found that some STLinkV2 clones can't flash very well the motor controller while other do it well. A good idea is to buy like 3 different STLinkV2 clones, from different shops.

JTAG SWD connector

The JTAG SWD pins are available on the board, on the pads as seen on next picture, with the following JTAG pins that you should connect to the STLinkV2:

Pad number
(from left to right)
JTAG name
1 GND
2 NRST
3 SWCLK
4 SWDIO
5 VCC 3.3V
(no need to connect if LCD is already powered on)

Software to flash

To flash the firmware, use the software tool that works on your operation system to flash the STM32F103 microcontrollers.

On the very first time, you will need to first erase and/or unlock the microcontroller.

Linux

Use OpenOCD.

Windows

Use the STM32 ST-LINK Utility. Here the main steps:

  • Target Chip erase
  • Load bin file (load the firmware bin file)
  • Target program
Clone this wiki locally