Index

LCD3

  1. C code example

LCD3

• Forum thread for discussion: https://endless-sphere.com/forums/viewtopic.php?t=94070
• OpenSource firmware sources are here: https://github.com/OpenSource-EBike-firmware/Kunteng_LCD3_firmware

LCD3 uses STM8S105C6T6 that has 32kbytes of flash memory.
The only other IC on the board is the LCD controller Holtek HT1622 that has datasheet in English language, there are even OpenSource Arduino firmware for it.

The flashing and debugging SWIM header is easily accessible on LCD3 board.

Linked file: HT1622_datasheet.pdf


Linked file: 2SA1013_datasheet.pdf


images/119-1.png

images/119-2.png

Signals on the board:



OSCI pin has a almost square wave of 32KHz.

Original firmware is protected. Reading Option Bytes, EEPROM and firmware area always returns file filled with zeros.

/* Connections:
*
* PIN | Function
* ----------------------------------------------------------
* PD0 | HT1622 /CS
* PA4 | HT1622 /READ
* PB7 | HT1622 /WRITE
* PC5 | HT1622 DATA
*
* PA2 | Enable power for LCD backlight (switch a very small mosfet to GND that goes to A1013 emitter pin)
* PC4 | enables LCD backlight
*
* PB2 | /button down
* PB1 | /button up
* PB0 | /button ON/OFF
*
* PE6 (AIN9) | connects to header J6 (this header is not connected and has 2 pads: GND and PE6)
* PE7 (AIN8) | battery voltage
*
* PE3 | seems to connect to a very small mosfet that enables battery voltage to some place, maybe to enable the motor controller?
* PG1 | input digital from a mosfet output, enabled buy the LCD Power ON button
*
* PB4 | connects to HT1622 VDD pin 8
*
*/

---

Erase and unlock STM8S105C6T6



1. echo "00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > erase_original_firmware_and_unlock.bin
2. sudo stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w erase_original_firmware_and_unlock.bin