Bafang 850C color LCD, currently working for TSDZ2 motor -- Flexible OpenSource firmware

casainho

10 GW
Joined
Feb 14, 2011
Messages
6,037
Finally I got Bafang 850C color LCD working!!!

My plan is to make it working for the TSDZ2 mid drive motor running our flexible OpenSource firmware (see here), as I did for KT-LCD3. But I think would be great if other developers want to join and use this LCD for other motor controllers.

- firmware is here: https://github.com/OpenSource-EBike-firmware/Color_LCD/tree/master/Bafang_LCD_850C_firmware
- wiki page with tecnhical details: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Bafang-850C





 
I am looking for help on design the user interface. I think it must have 2 different parts: 1. main screen that shows ebike real time data like wheel speed, motor usage power in watts, etc; 2. configurations screen.

The biggest differences from original firmware, I would like to add real time graph showing like previous last 5 minutes of motor data like power, motor temperature, user energy in watts of pedal power, etc.

For the configuration options, I would like to have a good text description of each option.
 
Current status:
[youtube]vdrahPO7ZVA[/youtube]

The way I flash/debug the firmware on development, using cheap STLinkV2 clone:
Bafang-850-C-firmware-02.jpg
[/url]

Bafang-850-C-firmware-01.jpg
[
 
How do you flash the display?
 
evolutiongts said:
How do you flash the display?
Follow the instructions on how to flash firmware on KT-LCD3 and wire to TSDZ2, it is similar.

More pins information: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Bafang-850C
 
Do you think its possible to use a ST-Link V2 and flash a .bin supplied by APT to flash the firmware?
 
evolutiongts said:
Do you think its possible to use a ST-Link V2 and flash a .bin supplied by APT to flash the firmware?
No it is not.
 
How would I boot the display into the bootloader? Would it help the opensource project if I shared the Windows Program to flash the bootloader / firmware?
 
evolutiongts said:
How would I boot the display into the bootloader? Would it help the opensource project if I shared the Windows Program to flash the bootloader / firmware?
No. I have that program and I know how it works and that is not of any help to us.
 
Hi,

How is this project going? I think this one was a good decision... Way back last year I experimented with Using a BBS harness for the TSDZ2, now I have a batch of these Motors with the 850C and Bafang Harness ( I see another company does too, actually )...

I see you said there was encryption involved so you could not update the firmware, correct?

Maybe there is something I can do, to give us the ability to directly load the firmware into the display, without having to modify it. This would be a great solution for people, as there would be no tampering with the motor or display, simply plug in, and upload new firmware... Of course they may want a metal gear and the temp sensor... which brings me to my last question... Did you have any plans to possibly use other ports for the signal of the temp sensor? If not, perhaps you will reconsider now that you see the 850C model TSDZ2 being available with the BBS harness with throttle etc... it would be nice for people to be able to use the whole system.

I think for this one, when you finish, I could maybe convince factory to install metal gear, temp sensor, and this firmware, to distribute directly to people. This would be very convenient so people who don't have the know how or capability to reprogram firmware etc could also use the motor!

I see you are working with another display too as well? FYI I finally got a chance to try your firmware after a leg injury that had me out... it is simply great... it is a bit quieter, can program more power, and the same amount of power if a little more now it seems ~more efficient, and of course, the assist fluctuation seems to 'roll on' much more compared to how it used to feel like individual 'steps'. Small steps, and was still smooth especially compared to cadence sensing, but still, nothing like it is now. GREAT WORK!

Let me know about the display firmware update process.., I might be able to help with that.
 
eyebyesickle said:
Maybe there is something I can do, to give us the ability to directly load the firmware into the display, without having to modify it. This would be a great solution for people, as there would be no tampering with the motor or display, simply plug in, and upload new firmware... Of course they may want a metal gear and the temp sensor... which brings me to my last question... Did you have any plans to possibly use other ports for the signal of the temp sensor? If not, perhaps you will reconsider now that you see the 850C model TSDZ2 being available with the BBS harness with throttle etc... it would be nice for people to be able to use the whole system.
I don't think they will let us use their bootloader but let's see what you can get.

I am working less on this project, I do not plan to "improve" the way temperature sensor works. Maybe some other developer want to do it.

I want to finish the design I did propose for 850C, that includes the graphs for the variables.
 
Making progress, hoping to hear good news by next week. I have another route to go if I don't get permission by then, but things appear to be working out.

You are currently using the 850c system for yourself, correct? Any new previews of the display screen to show off? I am trying not to crack open my 850C as is!!! Im too OCD for that mess :lol:
 
eyebyesickle said:
Making progress, hoping to hear good news by next week. I have another route to go if I don't get permission by then, but things appear to be working out.

You are currently using the 850c system for yourself, correct? Any new previews of the display screen to show off? I am trying not to crack open my 850C as is!!! Im too OCD for that mess :lol:
I am using yes but lately I am mire riding my bike than coding :) so I am late.
 
casainho said:
eyebyesickle said:
Making progress, hoping to hear good news by next week. I have another route to go if I don't get permission by then, but things appear to be working out.

You are currently using the 850c system for yourself, correct? Any new previews of the display screen to show off? I am trying not to crack open my 850C as is!!! Im too OCD for that mess :lol:
I am using yes but lately I am mire riding my bike than coding :) so I am late.

YES!!! :D Enjoy the fruits of your labor my dude!
 
Hello, please can I ask you for help?
I bougt the ST-Link V2 and was able to flash the firmware to the motor TSDZ2 and to the LCD KT-LCD3.
Now I bought a Bafang 850C display (http://www.pswpower.com/ven.php?cargo.2016-5e-2eaj)

I can flash the firmware with the STM32 ST-LINK Utility but when I turn on the display, I only see a bright white display without writing.

What can I do?
Thank you!
Michael
 
micha_ub said:
Hello, please can I ask you for help?
I bougt the ST-Link V2 and was able to flash the firmware to the motor TSDZ2 and to the LCD KT-LCD3.
Now I bought a Bafang 850C display (http://www.pswpower.com/ven.php?cargo.2016-5e-2eaj)

I can flash the firmware with the STM32 ST-LINK Utility but when I turn on the display, I only see a bright white display without writing.

What can I do?
Thank you!
Michael
That is strange.

Try flash again just to make sure it was not a mistake.

If you still get the issue, I would say it can be maybe the LCD orange flat slightly out of the place. Test this way:

Power on the display, even with full white, try increase the assist level, release the brake sensors and then try ride the bicycle to see if the motor assist and usual. If that happens, then the display is correctly flashed and working but the LCD has some issue. You should try, with power off, careful remove the orange flat cable and then insert again.

See this video how to remove the cable (note the on 850C that pad you need to lift in on the same side as the flat cable):

https://youtu.be/C9PwK9eGrCY
 
I have now done the test, if I change the assist level, then the engine seems to work as usual.

I have unplugged the orange flat cable and plugged in again, unfortunately, the screen is still white.

I have to say, that I tested the display befor flashing the software and it was working fine with the original firmware.

Thank you!
 
micha_ub said:
I have now done the test, if I change the assist level, then the engine seems to work as usual.

I have unplugged the orange flat cable and plugged in again, unfortunately, the screen is still white.

I have to say, that I tested the display befor flashing the software and it was working fine with the original firmware.

Thank you!
Well, seems you are out of luck.

Few days ago my LCD started to have some white lines on top, I expected it could be the cable but in the end I had to exchange for a new LCD from other 850C.

But at least you know it is not a problem of you being flashing incorrectly.

I have new firmware version mostly ready to be released, I hope to do it in next 2 or 3 days max.
 
pity, then I buy a new display.
Yes, you are right, at least I know what the problem is.

I'm already looking forward to the new firmware :)

Thank you for your help!
 
eyebyesickle said:
Making progress, hoping to hear good news by next week. I have another route to go if I don't get permission by then, but things appear to be working out.

You are currently using the 850c system for yourself, correct? Any new previews of the display screen to show off? I am trying not to crack open my 850C as is!!! Im too OCD for that mess :lol:

HAHAHA, hope to hear the good news by next week I said - just a few days shy of 6 months ago eh? WELL - at least it finally happened. Was not easy to obtain the information needed, that's for sure. Luckily we have pros on the team like casainho who knew what do to with said info, since my people are MIA :shock:

Everything is cleared with APT etc - and I also briefly mention a DIY method for making your own bootloader box - alhough this method is untested, and IMO may be more trouble than it is worth... but please let me know if anyone makes one and successfully upgrades, so we can update the article with the news!

FYI - Sending a bunch of these to a Chinese Warehouse for cheap/fast international shipping, and we already have plenty in the USA. 1750mm cords to make it a little easier on you if your display is mounted to your bike already... Things just got a little bit easier around here! Whew

850C Display - TSDZ2 Open Source Firmware - Plug and Play Bootloader Update Tutorial- ARTICLE WITH LINKS
https://www.eco-ebike.com/blogs/eco...en-source-firmware-bootloader-update-tutorial

850C Display - TSDZ2 Open Source Firmware - Plug and Play Bootloader Update Tutorial- VIDEO TUTORIAL / DEMO
[youtube]0efCpe-Yj50[/youtube]

FYI - the newest version with imperial unit/throttle/etc support IS NOT AVAILABLE YET for the bootloader, but is expected shortly. The bootloader DOES NOT USE THE SAME .bin FILE THAT YOU USE TO MANUALLY UPDATE!!!

Any ETA casainho? :wink:
 
casainho said:
Well, seems you are out of luck.

Few days ago my LCD started to have some white lines on top, I expected it could be the cable but in the end I had to exchange for a new LCD from other 850C.

But at least you know it is not a problem of you being flashing incorrectly.

I have new firmware version mostly ready to be released, I hope to do it in next 2 or 3 days max.

I have the same white screen.
When I look in STM32 ST-LINK Utility the MCU is halted.
When I manual start the MCU the screen shows but the screen is mirrored.
There is no way to start the MCU when you connect the battery

I tried the V0.3.0 and V0.2.0. Both do the same
 
Eggybert said:
casainho said:
Well, seems you are out of luck.

Few days ago my LCD started to have some white lines on top, I expected it could be the cable but in the end I had to exchange for a new LCD from other 850C.

But at least you know it is not a problem of you being flashing incorrectly.

I have new firmware version mostly ready to be released, I hope to do it in next 2 or 3 days max.

I have the same the same white screen.
When I look in STM32 ST-LINK Utility the MCU is halted.
When I manual start the MCU the screen shows but the screen is mirrored.
There is no way to start the MCU when you connect the battery

I tried the V0.3.0 and V0.2.0. Both do the same
Are you sure it is the same microcontroller??
 
Eggybert said:
Your right. It doesn't seems to be a ST micro.
It will program with the ST software.





When i google the number it is an gigadevice.
https://www.gigadevice.com/products...rm-cortex-m3/mainstream-line/gd32f103-series/
So that is the same microcontroller on the 850Cs I have on my ebikes: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Bafang-color-LCD-850C

What can be different is the LCD module itself. On bafang_500C_lcd_init(), there is a command to configure the vertical and horizontal flip:

Code:
  lcd_write_command(0x36); // set_address_mode
  // Vertical Flip: Normal display
  // Horizontal Flip: Flipped display
  // RGB/BGR Order: Pixels sent in BGR order
  // Column Address Order: Right to Left
  // Page Address Order: Top to Bottom
  lcd_write_data_8bits(0x0A);

I would look at the ILI9481 driver datasheet to find the configuration to do the vertical flip and then setup on the command: lcd_write_data_8bits(0x0A); -- should be a different value than 0x0A.
 
You can get the micro controller to start running after flashing?
What do you use for flashing the firmware?

my lcd syas HJ3218-01FPC-A2 on the flat ribbon cable
 
Back
Top