860C-850C OSF for Bafang BBSxx

AndZab

100 mW
Joined
May 27, 2020
Messages
40
Hello, please somebody can point me in the right direction, to develop a display fw for the stock Bafang mid-drives ?
I like most the 860C because bootloader serial uploading, without breaking it.
I only need basic running function, without parameters access (I can access them by PC sw tool, by the way)
Yes, I know, stock APT fw can do everything, but I like something different.

@casainho made a great fw for these displays, but little help for setting up development enviroement.
Maybe something can be derived from this big project.
I only need main-screen numbers, and PAS level changing.
Nothing else, at this time.
It can seems fool, but I have my good reasons to try that.

Thank you very much if somebody can help, is some way.
Regards
 
AndZab said:
Hello, please somebody can point me in the right direction, to develop a display fw for the stock Bafang mid-drives ?
I like most the 860C because bootloader serial uploading, without breaking it.
I only need basic running function, without parameters access (I can access them by PC sw tool, by the way)
Yes, I know, stock APT fw can do everything, but I like something different.

@casainho made a great fw for these displays, but little help for setting up development enviroement.
Maybe something can be derived from this big project.
I only need main-screen numbers, and PAS level changing.
Nothing else, at this time.
It can seems fool, but I have my good reasons to try that.

Thank you very much if somebody can help, is some way.
Regards
Yes, please do it!!

I suggest for do it to the OpenSource firmware for Bafang Mid BBSHD controller -- search on github for this OpenSource firmware!
 
casainho said:
Yes, please do it!!

I suggest for do it to the OpenSource firmware for Bafang Mid BBSHD controller -- search on github for this OpenSource firmware!

Hello casainho,
yes, surely I can eventually upload to github, when done...

But I can't find link to some information to install dev tools and build your display project.
I can find a lot for motors and controllers, but until now no info about setup developing enviroement for the displays.

I just have a 860C with right cable and power supply, ready to flash.
My idea is to begin with a simple main screen with basic data, no need for parameters access.
Only add PAS levels changing, to that.

It would be great to adapt your displays FW, with the Bafang protocol.
Can you help me, to start this thing ?
First I have to recompile your 860C project "as is", and test booloader flashing.
Then, if everything ok, I will see how to go ahead...

Thanks a lot, Regards
 
I use the Visual Code Studio, you can look at the TSDZ2 wireless firmware that uses the NRF52840 that is a ARM Cortex and there you will find the project configuration for Visual Code Studio, both to start the OpenOCD and to flash the firmware and debug the firmware.

You will need to search on web to learn about all that tools, about OpenOCD, GDB, and Visual Code Studio, etc.

You have here some documentation we did but may be missing some parts, is up to you to discover and learn and then please submit a pull request to improve the documentation, for the next developers:

https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_remote/documentation/README.md
 
casainho said:
I use the Visual Code Studio, you can look at the TSDZ2 wireless firmware that uses the NRF52840 that is a ARM Cortex and there you will find the project configuration for Visual Code Studio, both to start the OpenOCD and to flash the firmware and debug the firmware.

You will need to search on web to learn about all that tools, about OpenOCD, GDB, and Visual Code Studio, etc.

You have here some documentation we did but may be missing some parts, is up to you to discover and learn and then please submit a pull request to improve the documentation, for the next developers:

https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_remote/documentation/README.md

Hello casainho, I understand I cannot use more "classic" tools like Eclipse, ST VP, etc. under Windows.
Please confirm...
Something like this:
DebugSettings.png
 
AndZab said:
casainho said:
I use the Visual Code Studio, you can look at the TSDZ2 wireless firmware that uses the NRF52840 that is a ARM Cortex and there you will find the project configuration for Visual Code Studio, both to start the OpenOCD and to flash the firmware and debug the firmware.

You will need to search on web to learn about all that tools, about OpenOCD, GDB, and Visual Code Studio, etc.

You have here some documentation we did but may be missing some parts, is up to you to discover and learn and then please submit a pull request to improve the documentation, for the next developers:

https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_remote/documentation/README.md

Hello casainho, I understand I cannot use more "classic" tools like Eclipse, ST VP, etc. under Windows.
Please confirm...
Something like this:
DebugSettings.png
That is the Eclipse, that I used before using Visual Code Studio. Visual Code Studio will be easier for you, if you follow the link I sent - here for instance a debug session on my PC:

image.png


Here the folder with the configuration files for the Visual Code Studio:
https://github.com/OpenSourceEBike/TSDZ2_wireless/tree/master/EBike_wireless_TSDZ2/firmware/.vscode

Here the task file for build and clean the project, or to launch the OpenOCD: https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/tasks.json

And finally here the file configurations to launch the Flash and Debug the firmware, using the commands to OpenOCD:
https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/launch.json

I still need to use Eclipse, not because I prefer but because it is what works for the STM8 microcontroller on TSDZ2 mid drive motor.
 
casainho said:
That is the Eclipse, that I used before using Visual Code Studio. Visual Code Studio will be easier for you, if you follow the link I sent - here for instance a debug session on my PC:

Here the folder with the configuration files for the Visual Code Studio:
https://github.com/OpenSourceEBike/TSDZ2_wireless/tree/master/EBike_wireless_TSDZ2/firmware/.vscode

Here the task file for build and clean the project, or to launch the OpenOCD: https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/tasks.json

And finally here the file configurations to launch the Flash and Debug the firmware, using the commands to OpenOCD:
https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/launch.json

I still need to use Eclipse, not because I prefer but because it is what works for the STM8 microcontroller on TSDZ2 mid drive motor.

Hello casainho, thank you so much for your kind help.
I will begin to study all this new stuff...
I don't know Ubuntu at all, my last experiments on Linux were 15 years ago...
Can I install these tools under Terminal window on a Mac ?
(macOS Unix is almost like Linux)
If you think it's a waste of time, I'll make a new Ubuntu computer, but I prefer not...
Regards
 
AndZab said:
casainho said:
That is the Eclipse, that I used before using Visual Code Studio. Visual Code Studio will be easier for you, if you follow the link I sent - here for instance a debug session on my PC:

Here the folder with the configuration files for the Visual Code Studio:
https://github.com/OpenSourceEBike/TSDZ2_wireless/tree/master/EBike_wireless_TSDZ2/firmware/.vscode

Here the task file for build and clean the project, or to launch the OpenOCD: https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/tasks.json

And finally here the file configurations to launch the Flash and Debug the firmware, using the commands to OpenOCD:
https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/.vscode/launch.json

I still need to use Eclipse, not because I prefer but because it is what works for the STM8 microcontroller on TSDZ2 mid drive motor.

Hello casainho, thank you so much for your kind help.
I will begin to study all this new stuff...
I don't know Ubuntu at all, my last experiments on Linux were 15 years ago...
Can I install these tools under Terminal window on a Mac ?
(macOS Unix is almost like Linux)
If you think it's a waste of time, I'll make a new Ubuntu computer, but I prefer not...
Regards
You can install Linux Ubuntu on a virtual machine like Virtual Box, for free. It will be very fast to install and have Linux working.

I strong suggest you to go with a virtual machine and Linux Ubuntu because there will be very easy to install all the software tools. I am using the Linux Ubuntu and I know it is easy to install the development tools.

Linux is very popular today, thanks to many tecnology advances like Raspberry Pi that uses mainly Linux - there are users being introduced to Linux, using it on Raspberry Pi and using both as a regular computer.
 
casainho said:
You can install Linux Ubuntu on a virtual machine like Virtual Box, for free. It will be very fast to install and have Linux working.

I strong suggest you to go with a virtual machine and Linux Ubuntu because there will be very easy to install all the software tools. I am using the Linux Ubuntu and I know it is easy to install the development tools.

Linux is very popular today, thanks to many tecnology advances like Raspberry Pi that uses mainly Linux - there are users being introduced to Linux, using it on Raspberry Pi and using both as a regular computer.

Dear casainho, in the last month I was very busy, so I put myself on this projects with some weeks delay...

Whatever, first of all I developed a monitor tool to debug the serial lines, and to show the protocol traffic.
I grabbed all the protocol infos just available on the forums, to decode and list the commands from the display.
(if you have useful links about Bafang protocol, please let me know...)

In reality, I have yet to connect this tool, but I "cold" tested the software with some PC, and it works:

Higo5prot_example.png

Then, I followed your suggestions about Ubuntu, and I begun to install the debian tools.
After 15 years I missed Linux, I was doubtful about this os, but in the end is very similar to Macs, and I develop for Macs, too.

But I stopped myself, because a maybe important instruction picture is missing (flash_debug_1.png):

SwListMissingLink.png

My main problem is that, after I installed all the requested extensions, the Task Manager "Zhang Shen" do not show anything:

VSC_extensions.png

Please can you help me to load the project and start compiling it ?

Please note I'm writing a little doc for every installation step, as you asked me, so this can be useful for other developers, too.
If you fix me, you fix everybody :lol:

Thank you so much, Regards
 
AndZab said:
But I stopped myself, because a maybe important instruction picture is missing (flash_debug_1.png):

My main problem is that, after I installed all the requested extensions, the Task Manager "Zhang Shen" do not show anything:

Please can you help me to load the project and start compiling it ?
Yes, seems that instructions are missing the correct links for the images, unfortunately I can not do everything alone and no one corrected them.

The task manager shows you the tasks at left, see the next image. Anyway, I think you can click on F1 and a menu will open where you can write "task" and several options will be available, like run a task:



And I decided to stop develop for this displays, because it is hard and takes to much time. I am instead focusing on developing a mobile app, as it is much faster for developers to develop for mobile. Also my 860C displays started to give problems, one of them just stopped to working, and they are very expensive like 100€ and not produced to be repaired.

So I start to use now our own DIY wireless EBike wireless controller, that costs only 25€ in materials and is very easy and cheap to repair if needed. It can connect wireless to a remote and to a cycling GPS display like Garmin Edge.

3d_printed_box.png


3d_printed_box-2.png
 
casainho said:
Yes, seems that instructions are missing the correct links for the images, unfortunately I can not do everything alone and no one corrected them.

The task manager shows you the tasks at left, see the next image. Anyway, I think you can click on F1 and a menu will open where you can write "task" and several options will be available, like run a task:
....

And I decided to stop develop for this displays, because it is hard and takes to much time...

Hello casainho,
yes I know how much hard is to maintein projects, their documentations, and so on.
I developed Windows sofware for decades, in a former life.
Now I'm still doing IT, but much less development, and so not very updated on new enviroements.

Anyway, I decided to put myself on Ubuntu, and installed it on 3 PCs, with the aim to write the guide "Visual Studio Code for dummies"
I'm writing the procedures to put in place everything needed, starting with a clean PC.
With this guide, any kind of developer will have easy life to put in place his development enviroement.
So, we can take advantage of my complete ignorance (but with a lot of experience...)

I used tons of IDEs, but this VSC thing do not look very user friendly.
It does not seem an IDE, by the way...

I installed all needed tools, and downloaded the project from GitHub (by Git plugin, to be safe).
But something is still missing, because I do not see your tasks:

VSC_Casa.png

Please can you confirm the right task manager extension is the "Zhang Shen" one ?
You can see my current situation here (no listed tasks) :

VSC_ProjectDownloaded.png

Maybe I missed some step, like to create a "json" file, or whatever.
If you can point me on the right direction, then I'll write on the manual !

Also, your wireless project is wonderful, but too much advanced for me.
Mainly, I need something simpler:

- Get Color_LCD
- Cut off all the advanced parameters stuff
- Keep only the main screen reading and PAS level sending
- Switch protocol to Bafang

Please note you don't need advanced parameter screens on BBSxx, because you just have beautiful PC tool:

zxhwk_UltraLikeBBSHD_1.jpg

Thank you very much for your help !
Regards
 
AndZab said:
Please can you confirm the right task manager extension is the "Zhang Shen" one ?
You can see my current situation here (no listed tasks) :

Maybe I missed some step, like to create a "json" file, or whatever.
If you can point me on the right direction, then I'll write on the manual !
You are probably missing the .vscode folder on the root of the project folder:

 
casainho said:
You are probably missing the .vscode folder on the root of the project folder:

Oh yes, sure !
Where do you suggest to copy your .vscode folder ?

vsc_project.png

Thanks a lot !!
 
AndZab said:
Where do you suggest to copy your .vscode folder ?
I usually put on root on source of a project, but see for yourself where it makes sense for your project. You need to understand what is inside that folder and what makes more sense for your project organization.
 
casainho said:
AndZab said:
Where do you suggest to copy your .vscode folder ?
I usually put on root on source of a project, but see for yourself where it makes sense for your project. You need to understand what is inside that folder and what makes more sense for your project organization.
Hello casainho, I copied .vscode folder, with your files inside, to the project root.
It seems they were elaborated, but I got an error...
Also, TASK MANAGER: TASKS is still empty.
I'm sorry but I can't understand the logic of this VSC thing, compared to Eclipse...

vsc_extensionko.png

vsc_folders.png

My first goal is very simple:
Try to recompile 860C_v1.0.0-trip-bootloader.bin with no modifications, and upload it by serial wire to my 860C
This is to test the development system only.
No need to do any modification to source code, at this stage.
Real learning will be after that.

Usually this would be a simple operation, in theory...
But without a real IDE seems a daunting task.

What can I do ? Thank you very much
 
AndZab said:
My first goal is very simple:
Try to recompile 860C_v1.0.0-trip-bootloader.bin with no modifications, and upload it by serial wire to my 860C
This is to test the development system only.
No need to do any modification to source code, at this stage.
Real learning will be after that.

Usually this would be a simple operation, in theory...
But without a real IDE seems a daunting task.

What can I do ? Thank you very much
To build the code you need to use the regular Makefile on command line (the "build" task just do that). Go to folder Color_LCD/firmware and just run "make" on the command line and you should see the code being built.
 
casainho said:
To build the code you need to use the regular Makefile on command line (the "build" task just do that). Go to folder Color_LCD/firmware and just run "make" on the command line and you should see the code being built.

Hello casainho, I recompiled fine the project with batch "release-860C_bootloader.sh"
The produced bin is a little bigger then yours (+3k) but probably it's because my just downloaded libraries are more updated then yours.

But I didn't reflashed the .bin yet, because now 860C is loaded with original APT firmware for Bafang protocol.
Their firmware versions have same screens, and only requested protocol is different.
For example, I loaded a Bafang prot fw over a Lishui prot fw, to do now protocol investigations.
Screens are the same on both.

It's interesting that APT main screen loop is very simple, on serial communications.
It everytime reads Alarm/Current/Speed, and less frequently rewrite PAS Level / Light / Speed Limit
That's all.
You see here the full communication loop, inside red frame:

LoopMainScreen860Cbafang.png

I will test also DPC18 loop, to check if it's simple like that.
Using my smart debugging program, investigation it's easy.

After protocol experiments, I will begin to upload project bins, to make confidence with it.

Big problem remain that impossible VSC thing, really weird.
How can I fix that pseudo-IDE ?

As last chance, is it possible to import the project inside a normal Eclipse ?
What are the drawbacks to do so ?

Thank you very much, Regards
 
AndZab said:
Big problem remain that impossible VSC thing, really weird.
How can I fix that pseudo-IDE ?

As last chance, is it possible to import the project inside a normal Eclipse ?
What are the drawbacks to do so ?
You need to investigate by yourself, I can not help you as I do not use Eclipse now.
 
As promised I upload other protocol debugging screenshots for other Bafang displays.

I just uploaded screenshot for APT 860C display (Bafang compatible), some weeks ago.
Now I add a couple of screenshots for the two DPC-18 versions on the market.

A) This is protocol loop for BAFANG DPC-18 WITH 9 SPEED (VERSION FOR BBSxx MOTOR)
ALL 10 PAS LEVELS ARE USED AND SENT (FROM 0 TO 9):

LogDPC18-9speed3.png


B) This is protocol loop for BAFANG DPC-18 WITH ECO-SPORT (VERSION FOR G510 MOTOR)
ONLY 6 PAS LEVELS ARE USED AND SENT (0, 2, 4, 6, 8, 9):

LogDPC18_ECOSPORT.png

So, main difference is that PAS levels 1, 3, 5, 7 are not managed at all, and never sent to motor.
The second difference from previous display is that this newer version send the selected MODE (ECO or SPORT) with additional command "MODE"
This command frame do not exist in the 9-SPEED version for BBSxx motors.
I repeat, ECO-SPORT display manage only 6 PAS levels, with torque sensor you do not need more.
The SPORT mode enable the customized programming data, presetted by PC.
 
Back
Top