https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html

Random TSDZ2 notes

echo "00 00 ff 20 df 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin
stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w option_bytes_pwm_n_channels_enabled.bin
stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v3.bin

stm8flash -c stlinkv2 -p stm8s105?4 -w TSDZ2_improved_original_firmware-v3.bin
stm8flash -c stlinkv2 -p stm8s105?4 -s eeprom -w TSDZ2_48V_original_firmware_eeprom.bin
stm8flash -c stlinkv2 -p stm8s105?4 -s opt -w TSDZ2_48V_original_firmware_option_bytes.bin

ISP-Connector

1 VCC
2 SWIM
3 GND
4 RST

XH18 LCD wiring

https://www.displayfuture.com/Display/datasheet/controller/ST7735.pdf

https://warmcat.com/2016/08/26/st7735-tft-lcd-goodness.html

1 LED-K
2 LED-A
3 GND
4 VDD
5 TE
6 NC
7 /CS
8 /RESET
9 RS
10 /WR
11 /RD
12 D7
13 D6
14 D5
15 D4
16 D3
17 D2
18 D1
19 D0
20 GND

LCD-Connector

https://opensourceebikefirmware.bitbucket.io/kunteng_lcd3/LCD3_on_TSDZ2--Wire_KT-LCD_to_TSDZ2.html

black: GND (battery -)
green: VCC (battery +)
white: signal from LCD to motor to enable the controller, (VCC-0.9V, perhaps through an input diode in the LCD)
purple: brake switch / motor cut off when connected to GND
brown: serial data from motor/controller to LCD
orange: serial data from LCD to motor/controller

Speed sensor Connector

orange: GND
brown: 5V (controller MCU supply voltage)
green: headlight 6V
white: speed sensor input (with pullup resistor to 5V)
black: SWIM
purple: RESET