Bafang 850C color LCD -- Flexible OpenSource firmware

Get all your technical information about electric bikes here.
Post Reply
casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Oct 31 2018 5:24am

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-fir ... C_firmware
- wiki page with tecnhical details: https://github.com/OpenSource-EBike-fir ... afang-850C

Image

Image

Image
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Oct 31 2018 9:12am

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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Nov 15 2018 9:24am

Current status:


The way I flash/debug the firmware on development, using cheap STLinkV2 clone:
Image[/url]

Image[
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

evolutiongts   10 kW

10 kW
Posts: 775
Joined: Dec 31 2013 5:13pm
Location: Alhambra, CA

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by evolutiongts » Jan 30 2019 5:45pm

How do you flash the display?
http://www.electricrt.com
Electric Race Technologies

Schwinn 405 2WD Track Bike 18KW
EDGE 1500W Hub / MXUS 3K Turbo
ASI BAC 2000 / BAC 4000 Bluetooth
viewtopic.php?f=6&t=93079

10Kw KMX death trike
MUXUS 3K Turbo
Sabvoton 72V150A
Moto Wheels all around
Front Suspension Kit
viewtopic.php?f=6&t=83423

Giant Trance 4 Full Suspension
Cyclone 3000W
74V 3000W
http://endless-sphere.com/forums/viewto ... =6&t=59005

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Jan 31 2019 3:42am

evolutiongts wrote:
Jan 30 2019 5:45pm
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-fir ... afang-850C
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

evolutiongts   10 kW

10 kW
Posts: 775
Joined: Dec 31 2013 5:13pm
Location: Alhambra, CA

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by evolutiongts » Feb 01 2019 1:36pm

Do you think its possible to use a ST-Link V2 and flash a .bin supplied by APT to flash the firmware?
http://www.electricrt.com
Electric Race Technologies

Schwinn 405 2WD Track Bike 18KW
EDGE 1500W Hub / MXUS 3K Turbo
ASI BAC 2000 / BAC 4000 Bluetooth
viewtopic.php?f=6&t=93079

10Kw KMX death trike
MUXUS 3K Turbo
Sabvoton 72V150A
Moto Wheels all around
Front Suspension Kit
viewtopic.php?f=6&t=83423

Giant Trance 4 Full Suspension
Cyclone 3000W
74V 3000W
http://endless-sphere.com/forums/viewto ... =6&t=59005

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Feb 01 2019 1:38pm

evolutiongts wrote:
Feb 01 2019 1:36pm
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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

evolutiongts   10 kW

10 kW
Posts: 775
Joined: Dec 31 2013 5:13pm
Location: Alhambra, CA

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by evolutiongts » Feb 01 2019 2:07pm

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?
http://www.electricrt.com
Electric Race Technologies

Schwinn 405 2WD Track Bike 18KW
EDGE 1500W Hub / MXUS 3K Turbo
ASI BAC 2000 / BAC 4000 Bluetooth
viewtopic.php?f=6&t=93079

10Kw KMX death trike
MUXUS 3K Turbo
Sabvoton 72V150A
Moto Wheels all around
Front Suspension Kit
viewtopic.php?f=6&t=83423

Giant Trance 4 Full Suspension
Cyclone 3000W
74V 3000W
http://endless-sphere.com/forums/viewto ... =6&t=59005

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Feb 01 2019 2:18pm

evolutiongts wrote:
Feb 01 2019 2:07pm
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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

User avatar
eyebyesickle   10 kW

10 kW
Posts: 690
Joined: Apr 07 2015 9:28pm
Location: Nashville

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by eyebyesickle » Feb 06 2019 11:22pm

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.

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Feb 07 2019 3:18am

eyebyesickle wrote:
Feb 06 2019 11:22pm
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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

User avatar
eyebyesickle   10 kW

10 kW
Posts: 690
Joined: Apr 07 2015 9:28pm
Location: Nashville

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by eyebyesickle » Feb 21 2019 9:04pm

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:

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Feb 22 2019 2:31am

eyebyesickle wrote:
Feb 21 2019 9:04pm
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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

User avatar
eyebyesickle   10 kW

10 kW
Posts: 690
Joined: Apr 07 2015 9:28pm
Location: Nashville

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by eyebyesickle » Feb 22 2019 10:34pm

casainho wrote:
Feb 22 2019 2:31am
eyebyesickle wrote:
Feb 21 2019 9:04pm
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!

micha_ub   10 µW

10 µW
Posts: 6
Joined: Aug 15 2019 2:53am

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by micha_ub » Aug 16 2019 12:33am

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

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Aug 16 2019 2:50am

micha_ub wrote:
Aug 16 2019 12:33am
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
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

micha_ub   10 µW

10 µW
Posts: 6
Joined: Aug 15 2019 2:53am

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by micha_ub » Aug 16 2019 8:11am

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!

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Aug 16 2019 8:32am

micha_ub wrote:
Aug 16 2019 8:11am
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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

micha_ub   10 µW

10 µW
Posts: 6
Joined: Aug 15 2019 2:53am

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by micha_ub » Aug 16 2019 10:31am

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!

User avatar
eyebyesickle   10 kW

10 kW
Posts: 690
Joined: Apr 07 2015 9:28pm
Location: Nashville

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by eyebyesickle » Aug 18 2019 2:51am

eyebyesickle wrote:
Feb 21 2019 9:04pm
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-cyc ... e-tutorial

850C Display - TSDZ2 Open Source Firmware - Plug and Play Bootloader Update Tutorial- VIDEO TUTORIAL / DEMO


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:

Eggybert   1 mW

1 mW
Posts: 14
Joined: Aug 18 2019 3:20pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by Eggybert » Aug 18 2019 3:26pm

casainho wrote:
Aug 16 2019 8:32am
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
Last edited by Eggybert on Aug 19 2019 1:10am, edited 1 time in total.

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Aug 18 2019 4:43pm

Eggybert wrote:
Aug 18 2019 3:26pm
casainho wrote:
Aug 16 2019 8:32am
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??
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Eggybert   1 mW

1 mW
Posts: 14
Joined: Aug 18 2019 3:20pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by Eggybert » Aug 19 2019 1:50am

Your right. It doesn't seems to be a ST micro.
It will program with the ST software.

Image

Image

When i google the number it is an gigadevice.
https://www.gigadevice.com/products/mic ... 03-series/

casainho   1.21 GW

1.21 GW
Posts: 3687
Joined: Feb 14 2011 2:43pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by casainho » Aug 20 2019 9:41am

Eggybert wrote:
Aug 19 2019 1:50am
Your right. It doesn't seems to be a ST micro.
It will program with the ST software.

Image

Image

When i google the number it is an gigadevice.
https://www.gigadevice.com/products/mic ... 03-series/
So that is the same microcontroller on the 850Cs I have on my ebikes: https://github.com/OpenSource-EBike-fir ... r-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: Select all

  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.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and displays (Bafang 850C color, SW102 Bluetooth and KT-LCD3).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Eggybert   1 mW

1 mW
Posts: 14
Joined: Aug 18 2019 3:20pm

Re: Bafang 850C color LCD -- Flexible OpenSource firmware

Post by Eggybert » Aug 20 2019 9:58am

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
Last edited by Eggybert on Aug 20 2019 10:01am, edited 1 time in total.

Post Reply