• Hello ES! We could use some help to get us past the finish line on building the new knowledgebase for the forum.
    Can you donate? Please see our fundraising page. Thank you!

BAFANG M215 (BBS01 CAN bus), M315 (BBS02 CAN bus), M510, M560, M820, CR-A101 FOC Open Source EBiCS Firmware for GD32F303 processors

Today, i rode my bike about 3 h( it was bikepark like terrain) and twice happened the situation on which the motor was acting like i was using throttle but I did not. I had to restart the motor to stop that action. Once it occured after uphill and once after downhill. Besides it worked flawlessly.
 
In my case, the torque sensor drift went up to over 900, though that rarely happened. Right now, I've set the pedal threshold to 850
 
Hm, I think we should add a recalibration at runtime, if the idle value (cadence zero and PWM off for example) is not plausible.

We have a double check in resetting the torque counter. The torque has to be greater than the threshold and the PAS counter has to be smaller than the PAS timeout.

C:
    if(MS.torque_on_crank>tq_threshold&&PAS_counter<MP.PAS_timeout)torque_counter=0;//reset counter, if pressure on pedal and pedals rotating


So if you stop pedaling, the assistance will stop also. But especially when riding off-road, it's difficult to keep the pedals completely still enough to prevent a PAS pulse from being triggered. So the assistance is not switched off, if the idle signal is drifting above the threshold.
 
Last edited:
Hm, I think we should add a recalibration at runtime
I've added that feature to the v0.0084 now. The new calibration is executed, if the cadence is zero, the PWM is switched off and the idle value is more than 40mV off the first calibration at startup. Maybe the calibration is triggered, if you rest your leg on the pedal at a red traffic light, you have to try it, I have no M560 on my test bike at the moment. You can check the recent torque value in the calories field
https://github.com/EBiCS/BAFANG_GD3...0/latest_beta/EBiCS_for_M560_BL38_v0.0084.bin
 
Last edited:
Thank you for the feedback. Which version did you use? Can you look at the calories field, before switching off the system next time?
V0.0083
Question: dose this soft work with other display than dpc 245 because I want to change for dpc080? I bought dz41 and motor makes klicking sounds ...
 
I still have the “faulty” sensor. I’ll be able to prepare the motor for testing this issue within a week. It will be an M560 motor with an M510 controller. I assume the mechanical part from the M560 won’t interfere with reproducing the problem.
Hi, @stancecoke
I wasn’t able to assemble the motor last week. I only received the controller for the build yesterday, and I assembled the motor today. Then something totally unexpected happened - the controller turned out to have the BL3 bootloader.
I tried changing the header of the current firmware to match BL3 and managed to flash it onto the controller, but it doesn’t work (the display doesn’t turn on). Next, I tried using your binary file processing script from the repository, but that didn’t help either.
Could you tell me if there’s any way to adapt the latest version of your firmware for the BL3 bootloader?
So far, I’ve successfully managed to flash the older BL3 release:
 
Last edited:
Could you tell me if there’s any way to adapt the latest version of your firmware for the BL3 bootloader?
As the BL3 uses a different start address for the interrupt vector table, you have to recompile the code with different settings. You have to change two files. It's just a matter of a few seconds, if you have installed the tool chain.
I will provide a version later.
Files to edit:
config.h
gd32f30x_flash.ld
 
Last edited:
There should be no impact of the used display on the motor behaviour. As long as the display uses the known CAN protocol.
I installed dz41 display to M600 and it is ok but with m560 , the motor produced that clicking sound and it was felt a sort of stuggering. Can you explain this - are there different can bus protocols for m600 and 560?
 
I installed dz41 display to M600 and it is ok but with m560 , the motor produced that clicking sound and it was felt a sort of stuggering. Can you explain this - are there different can bus protocols for m600 and 560?
I just need to know that there’s a strange menu option in the DZ41 settings, after which the M560 controller burned out, turning to ash with minimal motor activity. I’m actually working on restoring it right now.
I can’t even guess what happened, but I’m not using that display anymore. Especially since there’s a great alternative - the SW‑102T display in the CAN version.
I’d guess that EBICS CAN communication methods still differ from the original ones. I have an SW102‑T that works with EBiCS on one motor but not on another, even though the motors are identical (M510 FC 3.0). Also, my original DPC245 displays (I have three of them) behave inconsistently on the same motor with EBiCS. Please keep in mind that EBiCS is not a fully finished release at the moment.
 
I’d guess that EBICS CAN communication methods still differ from the original ones
The commands that are implemented in EBiCS yet are identical to the original Bafang ones, otherwise they won't work with the display and the Canable tool. Maybe some commands from the original systems are still missing or are not documented at all since now. To see what is different in the DZ41 communication, we would have to sniff on the traffic on the CAN bus with the Canable and a tool like Cangaroo.
 
Back
Top