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

Aquakitty said:
I would be grateful for some technical guidance: how to debug, toolchain, IDE etc. I have nearly zero experience in microcontroller programming.
...

I'd like to know this too so I can help, but the process of the learning curve here keeps me from having the time. Is it basically started with some kind of dev kit for STM32? Just wondering if there is some information on the process.

I can help with this late this week (after putting out a SW102 release and adding a couple of features we've been wanting). If I edit our wiki page on how to install the devtools, how to do a build, and how to edit/debug, would that help? I'll do it assuming linux, but windows should be quite similar and would appreciate any corrections from windows users.

It turns out that the development environment for the 850C and SW102 quite nice and quite inexpensive. All you need is the device and a $4 ST-LINK USB to JTAG adapter. The software is essentially GCC+eclipse+openocd. The process to install is fairly painless, but yeah - we should improve the docs ;).

Also we'd absolutely love help and if anyone wants to start by taking an item off of the todo list we could happily chat on the devchat about what is required, give pointers, answer questions etc... https://github.com/OpenSource-EBike-firmware/Color_LCD/blob/sw102-merge/firmware/TODO.md
 
geeksville said:
I can help with this late this week (after putting out a SW102 release and adding a couple of features we've been wanting). If I edit our wiki page on how to install the devtools, how to do a build, and how to edit/debug, would that help? I'll do it assuming linux, but windows should be quite similar and would appreciate any corrections from windows users.

It turns out that the development environment for the 850C and SW102 quite nice and quite inexpensive. All you need is the device and a $4 ST-LINK USB to JTAG adapter. The software is essentially GCC+eclipse+openocd. The process to install is fairly painless, but yeah - we should improve the docs ;).

Also we'd absolutely love help and if anyone wants to start by taking an item off of the todo list we could happily chat on the devchat about what is required, give pointers, answer questions etc... https://github.com/OpenSource-EBike-firmware/Color_LCD/blob/sw102-merge/firmware/TODO.md

I managed to build and flash the firmware with your fixes, but none of two seems to work. I've tried to draw something on a screen using low-level functions like lcd_pixel_set, but screen remains white. Apparently the display isn't initialised correctly...
 
Maybe someone can look at the original firmware that works and compared with our init function -- here the disassembled files:

https://wetransfer.com/downloads/6d03fdd3b31871d91b3a8a5a6ffd4f8420190912070633/b1aa32676929dd509ada049845f7116120190912070633/9a132f
 
I have good news for those who had the White Screen Of Death issue (like me). This is a screen running OpenSource Firmware with a fix. Apparently the issue was that there's two slightly different versions of 850C: one with ILI9481 LCD driver and another with ST7796s. They are quite similar but ST7796 requires slightly different initialisation, timings and addressing (the X-axis is mirrored). All necessary fixes are already on review and soon will be ported back to the v0.4.0 firmware.
 

Attachments

  • IMG_6364.jpg
    IMG_6364.jpg
    114.4 KB · Views: 3,522
r0mko said:
I have good news for those who had the White Screen Of Death issue (like me). This is a screen running OpenSource Firmware with a fix. Apparently the issue was that there's two slightly different versions of 850C: one with ILI9481 LCD driver and another with ST7796s. They are quite similar but ST7796 requires slightly different initialisation, timings and addressing (the X-axis is mirrored). All necessary fixes are already on review and soon will be ported back to the v0.4.0 firmware.

Thank you very much r0mko (and thanks to all the other contributors)! I can‘t wait to get rid of the white screen and to finally ride my bike.
 
geeksville said:
Aquakitty said:
I would be grateful for some technical guidance: how to debug, toolchain, IDE etc. I have nearly zero experience in microcontroller programming.
...

I'd like to know this too so I can help, but the process of the learning curve here keeps me from having the time. Is it basically started with some kind of dev kit for STM32? Just wondering if there is some information on the process.

I can help with this late this week (after putting out a SW102 release and adding a couple of features we've been wanting). If I edit our wiki page on how to install the devtools, how to do a build, and how to edit/debug, would that help? I'll do it assuming linux, but windows should be quite similar and would appreciate any corrections from windows users.

It turns out that the development environment for the 850C and SW102 quite nice and quite inexpensive. All you need is the device and a $4 ST-LINK USB to JTAG adapter. The software is essentially GCC+eclipse+openocd. The process to install is fairly painless, but yeah - we should improve the docs ;).

Also we'd absolutely love help and if anyone wants to start by taking an item off of the todo list we could happily chat on the devchat about what is required, give pointers, answer questions etc... https://github.com/OpenSource-EBike-firmware/Color_LCD/blob/sw102-merge/firmware/TODO.md

Awesome thanks. Have everything I need already then to get started at least.
 
Hello, I tried flashing the latest firmware on my 850C last night but got the white screen issue. Is the recent fix merged in? if so, sounds like there may be more versions out there that aren't covered by the fix
 
speedstermcgee said:
Hello, I tried flashing the latest firmware on my 850C last night but got the white screen issue. Is the recent fix merged in? if so, sounds like there may be more versions out there that aren't covered by the fix

Yes, it was merged into master on 9/18: https://github.com/OpenSource-EBike-firmware/Color_LCD/commits/master

Did you do "make clean" first? Our dependencies on the 850C makefile don't properly check .h file changes.

You could try changing https://github.com/OpenSource-EBike-firmware/Color_LCD/blob/master/firmware/850C/src/ugui_driver/ugui_bafang_850c.c#L209 to instead just set "type = LCD_ST7796" if you want to see if the fix we concocted works for your display. If it turns out it does, then let's talk more and add the vendor code for your display.
 
geeksville said:
speedstermcgee said:
Hello, I tried flashing the latest firmware on my 850C last night but got the white screen issue. Is the recent fix merged in? if so, sounds like there may be more versions out there that aren't covered by the fix

Yes, it was merged into master on 9/18: https://github.com/OpenSource-EBike-firmware/Color_LCD/commits/master

Did you do "make clean" first? Our dependencies on the 850C makefile don't properly check .h file changes.

You could try changing https://github.com/OpenSource-EBike-firmware/Color_LCD/blob/master/firmware/850C/src/ugui_driver/ugui_bafang_850c.c#L209 to instead just set "type = LCD_ST7796" if you want to see if the fix we concocted works for your display. If it turns out it does, then let's talk more and add the vendor code for your display.

Do you already know when the bootloader version for users (well, non-users...) with the white screen issue could be ready?
 
h27 said:
Do you already know when the bootloader version for users (well, non-users...) with the white screen issue could be ready?
I hope to release on next Monday. I will test on both versions of 850C before releasing.
 
casainho said:
h27 said:
Do you already know when the bootloader version for users (well, non-users...) with the white screen issue could be ready?
I hope to release on next Monday. I will test on both versions of 850C before releasing.

:bigthumb: Great! Thank you very much.
 
h27 said:
casainho said:
h27 said:
Do you already know when the bootloader version for users (well, non-users...) with the white screen issue could be ready?
I hope to release on next Monday. I will test on both versions of 850C before releasing.

:bigthumb: Great! Thank you very much.

Casainho, do you already have news from the testing of the white screen-free version? I would appreciate it very much if I could get my bike running. :)
 
h27 said:
h27 said:
casainho said:
h27 said:
Do you already know when the bootloader version for users (well, non-users...) with the white screen issue could be ready?
I hope to release on next Monday. I will test on both versions of 850C before releasing.

:bigthumb: Great! Thank you very much.

Casainho, do you already have news from the testing of the white screen-free version? I would appreciate it very much if I could get my bike running. :)
Sorry but my PC is broken and I will need to buy a new one in next days... So, I can't promise I will have it working on next days.
 
casainho said:
h27 said:
h27 said:
casainho said:
I hope to release on next Monday. I will test on both versions of 850C before releasing.

:bigthumb: Great! Thank you very much.

Casainho, do you already have news from the testing of the white screen-free version? I would appreciate it very much if I could get my bike running. :)
Sorry but my PC is broken and I will need to buy a new one in next days... So, I can't promise I will have it working on next days.

Thanks, too bad - I hope you will be up and running again soon.
Is it possible for somebody else to do the testing and the compilation? Probably everybody who has bought their 850C from the recommended source since I have (5 weeks ago) has the same white screen issue and can't use their new equipment.
 
There is a new firmware version for 850C displays - get it here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/850C_v0.4.1

Changelog:
- change code in the hope to solve the issue of white screen on some 850C displays. Seems some of them have different LCDs inside.

I was not able to test myself on the ones that have the white screen but that was tested by the other developers. The solution would not be possible without the help on the developers geeksville and r0mko as also the donors of the 850C display with the issue.
 
casainho said:
There is a new firmware version for 850C displays - get it here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/850C_v0.4.1

Changelog:
- change code in the hope to solve the issue of white screen on some 850C displays. Seems some of them have different LCDs inside.

I was not able to test myself on the ones that have the white screen but that was tested by the other developers. The solution would not be possible without the help on the developers geeksville and r0mko as also the donors of the 850C display with the issue.

You are my hero! I will install tonight and make a feedback if the issue with the white screen is solved.
Thank you all for your efforts.
 
h27 said:
casainho said:
There is a new firmware version for 850C displays - get it here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/850C_v0.4.1

Changelog:
- change code in the hope to solve the issue of white screen on some 850C displays. Seems some of them have different LCDs inside.

I was not able to test myself on the ones that have the white screen but that was tested by the other developers. The solution would not be possible without the help on the developers geeksville and r0mko as also the donors of the 850C display with the issue.


You are my hero! I will install tonight and make a feedback if the issue with the white screen is solved.
Thank you all for your efforts.
The issue with the white screen is resolved indeed. But I am a bit desparate: The information shown on the display is now mirrored. Help appreciated!
 
h27 said:
The issue with the white screen is resolved indeed. But I am a bit desparate: The information shown on the display is now mirrored. Help appreciated!
Not bad at all. When debugging I saw my LCD be inverted and it was detecting wrong the version of LCD controller. So, I think our init code can work perfectly for both LCD versions only there is the need of inversion.

Options:
1. keep debugging the code up to find how to correctly detect the versions
2. build and make available the 2 different versions and user will need to flash the other version if the first one is inverted
3. make an option on configurations to invert the LCD, I mean that would be like 2. but user select on the configurations (I guess it will be able to select with inverted)

I go for 3. as I can do it right now where I am without access to debug and test on the 850C display. Also this firmware is temporary until next v0.5.0.
 
please test this firmware: https://drive.google.com/file/d/14FRFI9VLE-6MnVI52DOefh20zy1y64AK/view?usp=sharing

Configuration option: LCD vertical flip. Please report
 
casainho said:
please test this firmware: https://drive.google.com/file/d/14FRFI9VLE-6MnVI52DOefh20zy1y64AK/view?usp=sharing

Configuration option: LCD vertical flip. Please report
Thanks a lot again! I will install, try and report this evening.
 
h27 said:
casainho said:
please test this firmware: https://drive.google.com/file/d/14FRFI9VLE-6MnVI52DOefh20zy1y64AK/view?usp=sharing

Configuration option: LCD vertical flip. Please report
Thanks a lot again! I will install, try and report this evening.
I tested the firmware: I could change the display setting to invert but it didn‘t change the screen. I also tried to turn off/restart the screen, but the invert setting is not being saved (after restart the setting is back to default).
In general I think you are right with option 3. There will probably more versions of the display and it makes more sense to just flip the screen in the settings than trying to to do the programming for all possible versions.
AB09F193-1BA2-4BA3-AC61-A864EE4E6025.jpeg
 
h27 said:
h27 said:
casainho said:
please test this firmware: https://drive.google.com/file/d/14FRFI9VLE-6MnVI52DOefh20zy1y64AK/view?usp=sharing

Configuration option: LCD vertical flip. Please report
Thanks a lot again! I will install, try and report this evening.
I tested the firmware: I could change the display setting to invert but it didn‘t change the screen. I also tried to turn off/restart the screen, but the invert setting is not being saved (after restart the setting is back to default).
In general I think you are right with option 3. There will probably more versions of the display and it makes more sense to just flip the screen in the settings than trying to to do the programming for all possible versions.
AB09F193-1BA2-4BA3-AC61-A864EE4E6025.jpeg
You are correct, I forgot to implement the save variable so it will never make any difference at startup. I will finish that as also make the system reset automatically every time the user changes that configuration.
 
Tested the new firmware - seems to be running on the new version of the display

850c TFTGDV2.3CL60 AKSM2.0
V5.2 201907110037
2019 07 11 0037 - seems to be the production date

still inverted but anyways

thanks a lot for the great work casainho


####
when everything works ill make a tutorial for a diy flash cable an sources for the parts in germany/ EU
 
casainho said:
h27 said:
h27 said:
casainho said:
please test this firmware: https://drive.google.com/file/d/14FRFI9VLE-6MnVI52DOefh20zy1y64AK/view?usp=sharing

Configuration option: LCD vertical flip. Please report
Thanks a lot again! I will install, try and report this evening.
I tested the firmware: I could change the display setting to invert but it didn‘t change the screen. I also tried to turn off/restart the screen, but the invert setting is not being saved (after restart the setting is back to default).
In general I think you are right with option 3. There will probably more versions of the display and it makes more sense to just flip the screen in the settings than trying to to do the programming for all possible versions.
AB09F193-1BA2-4BA3-AC61-A864EE4E6025.jpeg
You are correct, I forgot to implement the save variable so it will never make any difference at startup. I will finish that as also make the system reset automatically every time the user changes that configuration.
Great, thanks.
 
Back
Top