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

Yes. I'll have have to check your firmware file first. Is it available somewhere?
I'm on a weekend trip, so I can build a specific bin file on Monday.
 

Attachments

  • MMG5300C4825F801001.5_750W_Throttle 45kmh_20240430.bin.7z
    65.3 KB · Views: 7
  • firmwares_pack.zip
    14.8 MB · Views: 19
I received motor the current revision (Rev. 6) M510 FC 3.0.
EBiCS can't be loaded onto this motor because the boot code has changed. According to the forum, the torque sensor has been changed. There have also been minor changes to the printed circuit board. I'll add that the firmware works well, but it is, of course, proprietary.
 

Attachments

  • MMG522C4814F803082.4_20250414.zip
    145.1 KB · Views: 16
According to the forum, the torque sensor has been changed
Is there any detailed information? I only know the PAS has changes from Hall sensors to an optical sensor. But this should be no problem for the firmware. Maybe the calculated cadence is not correct, but that's easy to fix...

I wonder why Bafang changes the controllers hardware faster than others change their underwear. There will never be a proper increase of maturity for the firmware, if you have to maintain service for hundreds of variants...
 
Last edited:
Is there any detailed information?
No, I don't have any specific details. I heard somewhere that the torque sensor resolution has been increased. At least, the starting voltage hasn't changed (750 mV).
I wonder why Bafang changes the controllers hardware faster than others change their underwear. There will never be a proper increase of maturity for the firmware, if you have to maintain service for hundreds of variants...
The Bafang has many issues compared to market leaders: high noise (M560), not the most natural power delivery, and not the best energy efficiency. As far as I know, there's also an FC 4.0 version, the M510 RS, with a multi-point speed sensor in the form of a 42-hole disc.
 
I can build a specific bin file on Monday.
I've set the vector table offset to 0xA800 that works for my hub motor controller with bootloader V38 and edited the header according to the original Bafang ones from #179 and #180. The firmware itself is the V0.006 from the M510 branch. I have no possibility to check, if it works, as I don't have the hardware for the M510 and M560 with BL38.
Good luck with trying it ;)

regards
stancecoke
 

Attachments

  • OSF.zip
    53.3 KB · Views: 5
Last edited:
I've set the vector table offset to 0xA800 that works for my hub motor controller with bootloader V38 and edited the header according to the original Bafang ones from #179 and #180.
Preliminary report.
Bafang M510 FC 3.0 | Throttle – not used. | Battery – 52v (14S).
1) I was able to install the firmware via Canable without any problems.
2) The power button on the display doesn't work (turns on but doesn't turn off).
3) The battery level isn't displayed on the display (0%). I have a Bluetooth smart BMS, so I know the actual battery level.
4) "Motor Type" for the Bafang M510 = 0 (Reverse). When set to "1," the motor rotates in the opposite direction.
5) Walk Assist works, but it functions as a throttle handle; the Legal Mod is worked.
6) Assist is worked. I'll be able to ride the bike later, hopefully tomorrow.

What are the issues?
1) The main thing: a detailed description of each function is needed, especially functions with the "Different" flag. Some of the information on GitHub is outdated. I need to review this entire thread to see some important updates.
2) I don't know what the phase current limitation on my motor should be. Theoretically, it could be 2-3 times higher than the battery current. But I don't have any specific data.
P.S.: I'm communicating via Google Translate. If you see anything strange or incorrect in the text, please ask.
 
Last edited:
Preliminary report.
Thank you for the feedback! (y)
but doesn't turn off
The switch off algorithm was quite tricky for my M510 controller, on the hub motor controller the behaviour of the voltage on the ADC line for the On/Off button was completely different. Maybe Bafang changed it for newer controllers.

The battery level isn't displayed on the display
That's strange. Have you set the right system voltage in the Canable Tool?

I'm looking forward to hear your experience with riding!
 
Last edited:
That's strange. Have you set the right system voltage in the Canable Tool?
Perhaps I misunderstood or overlooked the voltage setting procedure. I can select 36, 43, and 48 volts (there's no 52-volt option). Selecting any other option immediately resets everything to 36 volts.
The switch off algorithm was quite tricky for my M510 controller, on the hub motor controller the behaviour of the voltage on the ADC line for the On/Off button was completely different.
As a user, I would never have thought that this particular function would be difficult to implement :)
 
there's no 52-volt option
52V (13s) is called 48V nominally.
But the display should show 100% when set to 36V.
Maybe you hardware has the voltage sensing on a different ADC input pit. We have to check that. Can your display show the calories? I'm using this field for debugging.
Is the voltage shown correctly in the live controller data of the Canable tool?
 
52V (13s) is called 48V nominally
The Bafang firmware with a 52-volt rating is for a 14S battery with a maximum voltage of 58.8 volts. I have this firmware for the M560.

Can your display show the calories?
The problem was with the display. I'm using a non-original SW102T CAN display because it's compact. When I connected the original DPC245, the SOC reading reached 100% within 1-2 seconds of booting.
Is the voltage shown correctly in the live controller data of the Canable tool?
Yes
 

Attachments

  • 1774256231193.jpg
    1774256231193.jpg
    503.8 KB · Views: 7
  • 1774256231134.jpg
    1774256231134.jpg
    881.3 KB · Views: 7
I've replaced the shut off algorithm with the one from the hub motor controller. @Avatarkhorn, you can try, if it works now!
I noticed that the old algorithm also works on the DPC245 display.

Testing #1
Bafang M510 FC 3.0 | Throttle – not used. | Battery – 52v (14S).
DPC245 Display | FW - EBiCS_for_M510_BL38_v0.006

Failed. During acceleration, the motor periodically stops abruptly for a short time. When the motor stops, the number "1" appears on the display.
Possible cause: incorrect calibration in the EBiCS firmware for this motor. The position sensor calibration process does not work as expected with the EBiCS firmware. A slight rotation occurs.
Rolled back to the original firmware and calibrated.

Pros:
+ The settings related to Assist appear to be working properly.
+ The power button on the DPC245 display works correctly.

Plans for Testing #2
1) Retest with the "original" motor calibration.
2) Increase the number of speed sensor magnets to 6.
3) Test the display shutdown algorithm on the SW102T and DCP245 in firmware BL38_v0.0061
 
When the motor stops, the number "1" appears on the display
I had this behaviour also, but I have no explanation so far. It is an issue with the off road routine, it should only engage, if two fast following button clicks are detected. Perhaps I have to add a minimum time between the clicks to avoid misfires.
 
I've replaced the shut off algorithm with the one from the hub motor controller. @Avatarkhorn, you can try, if it works now!
Danger!
After the EBiCS_for_M510_BL38_v0.0061 update, both displays, SW102T and DPC245, won't turn on. A downgrade to M510_BL38_v0.006 was performed using BESST. Canable requires a powered display.
 
During acceleration, the motor periodically stops abruptly for a short time
I've added a minimum time between two clicks for the offroad code now, but I haven't tested it yet.
I hope this solves the issue with the motor stops.
And went back to the "old" M510 shut off routine, of course.
 

Attachments

  • EBiCS_for_M510_BL38_v0.0062.zip
    27 KB · Views: 3
I've set the vector table offset to 0xA800 that works for my hub motor controller with bootloader V38 and edited the header according to the original Bafang ones from #179 and #180. The firmware itself is the V0.006 from the M510 branch. I have no possibility to check, if it works, as I don't have the hardware for the M510 and M560 with BL38.
Good luck with trying it ;)

regards
stancecoke
The firmware installed on the M560, and the position sensor calibration went fine. Then I pulled the throttle trigger to test without the chain. The motor started spinning normally, but after a second the screen shut off. It turned out the battery contact had burned out. The current seemed to be significantly higher than 25A.
 
Back
Top