Index

About Tongsheng TSDZ2 mid drive motors

  1. Motor controller
    1. log
  2. LCD - VLCD5
  3. Motor
  4. Torque sensor and PAS

Datasheets and application notes

  1. STM8S105S4T6

Development tools

Various

  1. 2018.04.18 - original firmware and debug session using OpenOCD
  2. 2018.04.19 - First code runs: Hello world
  3. Math operations CPU time

Development tools


Please see on this page, as the microcontroller is just the same and so are the development tools: https://opensourceebikefirmware.bitbucket.io

Specific to TSDZ2 motor controller



The connection for firmware programming and debug are available on the connector for the speed sensor -- see below more details.

The original firmware was not read protected. I was able to read the option bytes, firmware, EEPROM and finally connect with OpenOCD for a debug session.

TSDZ2 motor controller:
images/10-1.png

Connection of STLinkV2 clone to the controller, on the wires available on the speed sensor connector:
images/10-2.png

The connections to STLinkV2 clone:
Purple wire: RST
Orange: GND
Black: SWIM
images/10-3.png

Reading Option Bytes and original firmware with stm8flash and connect a debug session using OpenOCD:
images/10-4.png

Reading EEPROM:
images/10-5.png

Original Option Bytes and Firmware:
Linked file: TSDZ2_original_firmware_protected_option_bytes.bin


Contents of the option bytes of the read file:
images/10-6.png

Read original firmware file:
Linked file: TSDZ2_original_firmware.bin


EEPROM:
Linked file: TSDZ2_original_firmware_eeprom.bin