Files required for the TSDZ2  SW102 OSF update 

SW102 display has to be already flashed with OSF to access the bootloader feature which enables firmware updates via Bluetooth. 

The open source firmware files can be found in the project's GitHub repository: 

https://github.com/emmebrusa/TSDZ2-Smart-EBike-860C/releases

For the SW102 display, you will need a ZIP file starting with a sw102-otaupdate* name e.g. sw102-otaupdate-20.1C.5.zip 

The motor controller firmware is an HEX file e.g. TSDZ2-v20.1C.5-860C.hex 

Flashing the TSDZ2 motor controller with OSF for SW102/860C

To flash the motor controller you need a TSDZ2 programming kit.

The firmware file will be flashed using the STVP software: 

https://www.st.com/en/development-tools/stvp-stm32.html

1. When configuring please select the STM8S105x6 as in the screenshot below:

2. Then you can go to File -> Open and select the .hex file with the motor controller firmware: 

3. Next, you program the controller by going to Program -> All tabs

4. The console log should display the success message. You are done. 

Updating the SW102 display with the TSDZ2 OSF

1. Install the nRF Device Firmware Update application:

https://www.nordicsemi.com/Products/Development-tools/nRF-Device-Firmware-Update

2. Connect the SW102 display to the TSDZ2 motor controller. The motor controller has to be connected to a battery. Press and hold the M key on the SW102. Then press and hold the power button. Keep both buttons pressed down for at least eight seconds. You can then release the buttons. You are in the bootloader if the screen stays dark and doesn't power up.

3. Run the "DFU" application on your smartphone.

4. Select the sw102-otaupdate*.zip file. 

5. Connect to the SW102 display.

6. If there is a prompt asking for the file type please select "Application".

7. Hit the start button and wait for the update process to finish.

8. If the display is powered on please power it off. Then, power it on and see if it works correctly.