Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Bafang color LCD 850C

casainho edited this page Mar 10, 2020 · 7 revisions

Table of Contents

Bafang 850C LCD is a color LCD that is manufactured by http://aptdevelop.com/.

Our OpenSource firmware repository: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki

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

Board

Picture of the board:

The backside of the board is glued to LCD. Seems the board has 2 layers.

LCD

LCD flat connector wiring

PCB connector pin Connection to
1 GND
2 2V (turn on this voltage by 1 logic on PA14)
3 2V (turn on this voltage by 1 logic on PA14)
4 2V (turn on this voltage by 1 logic on PA14)
5 2V (turn on this voltage by 1 logic on PA14)
6 2V (turn on this voltage by 1 logic on PA14)
7 GND
8 GND
9 PC4 (chip select signal)
10 PC3 (command/data signal)
11 PC5 (write strobe signal)
12 PC7 (rd strobe signal)
13 NC (not connected)
14 NC
15 NC
16 PB15
17 PB14
18 PB13
19 PB12
20 PB10
21 PB9
22 PB8
23 PB7
24 PB6
25 PB5
26 PB4
27 PB3
28 PB2
29 PB1
30 PB0
31 NC
32 NC
33 NC
34 NC
35 NC
36 PC6 (display reset signal)
37 GND
38 NC
39 NC
40 NC
41 3.3V
42 3.3V
43 3.3V
44 NC
45 NC

NOTE: When the LCD flat cable is unconnected, the microcontroller keeps driving the data lines with signals.

LCD signals

Write strobe signal (PC5):



Chip select signal (PC4):

Command/data signal (PC3):

Wiring

Cable to motor controller

Bafang 850C wires motor controller wire function
brown wire (P+) battery voltage
orange wire Vin
black wire GND ground
green wire UART TX motor controller
white wire UART RX motor controller

Integrated ICs

GD32F103RET6

This is a 32 bits ARM Cortex M3 that should be very similar to STM32F103.

GD32F103RET6 main characteristics:

  • Maximum Speed Up to 108MHz
  • Flash Memory: 512K
  • RAM: 64K
  • Package: LQFP64
Pin number Function
20 (PA4) ADC01_IN4, measure battery voltage. Battery voltage first goes over D5 and then R29 and R31 forms the voltage divider. R29 is connected in one side to GND.

R31 = 200kohms; R29 = 10kohms. Vout = Vin * (R2 / (R2+R1)); Vout = Vin * 0,048.

Resources:

XL7015

This is a DC-DC converter that converts the battery voltage to 5V.

  • When LCD is powered off, this IC is not running.
  • The Enable pin seems to be wired to ground with a resistor and not controlled by the microcontroller.
The battery voltage is available to XL7015 only when Q3 and Q2 are drive with a signal from GDF32F103RET6 pin PC1 (signal goes over D1).

LD1117A

U3, marked as E17E, is a Low Dropout Positive Voltage Regulator that outputs 3.3V.

  • When LCD is powered off, this IC is not running.

AT24C16B

U5, marked as ATMLH152 16B, is Two-wire Serial EEPROM of 2kbytes.

  • it is powered with 5V

TI 82 2512

This integrated circuit may be responsible to control the USB charger. The microcontroller pin 17 / PA3 controls a line of this integrated circuit to enable/disable the USB charger.

Light sensor

On some boards seems that is populated a light sensor with label D7 and it is on the board back side (LCD side).

There are 2 pins connected to the microcontroller, maybe one is for excitation of the light sensor and other to measure the voltage at the light sensor terminals.

Microcontroller pin 15: measure sensor voltage. Pin 19: excitation.

USB

Although the USB pins are connected to the board (unknown connections to the board), the USB pins of the GDF32F103RET6 are both connected to GND.
Was verified that the USB pins are not connected to UART TX/RX pins that goes to the motor controller.

Maybe the USB pins connected to board are needed for start charging of USB device.

Bootloader

Seems that original firmware includes a bootloader, because there is a Windows software provided by the manufacture that flash new firmware by the UART pins/wires that goes to the motor controller.

Flash and debug

The JTAG SWD pins are available on the board, on the pads as seen on next picture, with the following JTAG pins:

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)