BBS-FW: Open Source Firmware for BBSHD/BBS02 Controller

Wait, you haven't done the configuration yet? You kind of do need a machine w/windows for now,
or you could use the firmware to do the setup(manually editing cfgstore.c/load_default_config()).

I've written a replacement for the tool, but adding windows support to it made such a mess out of it,
that i'm unlikely to clean it up for having my name on it anytime soon, so not willing to share the src atm.:sneaky:
If you have rpi4 or 5 or something, i could perhaps give it as a binary.
take your time though i would love it if the tool translated target speed and target power into actual MPH/KMH and Amps based on max speed set and max controller amps set
 
Hello, I successfully flashed my BBS02b 750W with Daniels firmware! Mine is (STC15F2K60S2). I can't be thankful enough what a good job this guy did!
Anyway, I noticed funny bonus thing. So I have this display 600C-BLE, when it starts it has nice animation how all information flows in and gets ready, but on Youtube I noticed that others also have this battery bar going UP animation. Mine did not did this (well I thought not big deal, maybe I have lil older display firmware, its ok). But after replacing Bafang stock FW in motor with this Open Source FW, my display also now does this battery animation! Go figure.
So I have no idea how is this related, but maybe this is some silly clue that will give Daniel some ideas about his code.

embed.js [img]
 

Attachments

  • display show.gif
    display show.gif
    3.4 MB · Views: 29
Last edited:
but on Youtube I noticed that others also have this battery bar going UP animation.

embed.js [img]
That looks to me like a voltage display (51.8 volts?) Maybe some bafang fw's don't communicate this...?
 
Last edited:
That looks to me like a voltage display (51.8 volts?) Maybe some bafang fw's don't communicate this...?
Yes it is. Nah, don't get me wrong, the original FW does report volts and green bar was there showing battery drain in same green bar. Just that it was not animated as now.
 
Yes it is. Nah, don't get me wrong, the original FW does report volts and green bar was there showing battery drain in same green bar. Just that it was not animated as now.
Ok, understood. In that case........no idea:D. Nice display though.
 
Right so it would seem like I have developed the dreaded temp sensor and battery voltage error due to me accidentally shorting the P+ and rx pins when I was trying to straighten after a new stiff connector met my soft brittle harness!!
The symptoms are the 30% power limit and after the screen is on for a bit I get error 30
Is there any forks that remove the need for these sensors?
The config tool will throw an error of temp limit reached and when I disable all sensors I get the limit disabled but it seems to be still active. I'm able to flash any firmware
Or is there a way to flush/reset these sensors? (It would seem like they are stuck on signal high/low possibly??)
I wanna make sure I exhaust all possible avenues before I buy a new controller
 

Attachments

  • IMG-20250131-WA0000.jpeg
    IMG-20250131-WA0000.jpeg
    1.2 MB · Views: 13
Last edited:
If P+ is battery voltage, and it was shorted to the rx pin, then whatever device's rx pin that is is probably damaged--the transceiver or buffer for the rx pin could be destroyed, or if that line goes right to the MCU, the MCU would have been damaged directly. Whatever part it goes to, if replaced, may fix it.
 
If P+ is battery voltage, and it was shorted to the rx pin, then whatever device's rx pin that is is probably damaged--the transceiver or buffer for the rx pin could be destroyed, or if that line goes right to the MCU, the MCU would have been damaged directly. Whatever part it goes to, if replaced, may fix it.
so Pl is the voltage line.....
the p+ is the 5v line to power the screen.
Controller is flashable and programmable and it powers up but the voltage will jump up to 60'ish volts when i engage the throttle and release.
i am hoping someone was able to flash a stock firmware that will overwrite the second MCU that has the error.
Speed sensor seems to be borked also
i have an old controller i might try on it see if the problem persists
if anyone has a link to a stock BBS02B firmware i would be forever grateful!!!!

EDIT:
The config tool will show an error in the log when the two temp sensors are active and engage the thermal limiter.
It will also show unable to get Voltage from controller.


The error 30 is gone (i had Rx and Tx swapped in my infinite wisdom)
 
Last edited:
If it can't even measure the voltage anymore, what is it good for? Sounds like a broken controller to me.
You just got lucky, that it's still flashable/programmable and working far enough to even connect to it.

I've let the magic smoke escape one controller of mine, so i know how it sucks to wait to get another.
 
so Pl is the voltage line.....
the p+ is the 5v line to power the screen.
iirc., the screen does turn on the controller, so there would be no 5v for it wake up with if the controller isn't running.

Which means the screen doesn't run off the 5v, but is powered by battery voltage directly.
 
iirc., the screen does turn on the controller, so there would be no 5v for it wake up with if the controller isn't running.

Which means the screen doesn't run off the 5v, but is powered by battery voltage directly.
Do you have this motor?
 
i see that some options have been added on 1.5 for the throttle, which settings would be recommended for more smooth throttle response? im currently on 1.4 and i use a thumb throttle (cyc style)
 
i see that some options have been added on 1.5 for the throttle, which settings would be recommended for more smooth throttle response? im currently on 1.4 and i use a thumb throttle (cyc style)
iirc., the change does bring smoother throttle by default, and it's not even configurable from the tool.
Personally i use the new default, while i did use the quadratic for a long while before 1.5 i just like the custom map even more.

So, it's hard to go wrong when both options are smoother than the linear response 1.4 had.
 
iirc., the screen does turn on the controller, so there would be no 5v for it wake up with if the controller isn't running.

Which means the screen doesn't run off the 5v, but is powered by battery voltage directly.
So would the screen still work if i have the PL and P+ SWAPPED?
ive got three controllers each with a different issue,
ONE has temp sensor issue (thermal limit enacted when sensor are active
ONE has 0 voltage but screen shows 54.6v and no speed sensor
The last i have no speed senor and throttle is intermittent but full PAS. (this will get me to and from train for work)
These all have BBS02B 1.4
the last one has throttle and pas on the stock FW but the speed sensor issue means i need the OP FW to disable the sensor but i lose Throttle after a restart very strange ill order a new controller but i would like to fix what i have here
 
So would the screen still work if i have the PL and P+ SWAPPED?
Is PL battery voltage? and P+ 5v? If so, then swapping htem connects battery voltage to 5v parts, and probably damages or destroys whatever is built to be powered from that 5v line, as they won't have protection against this, or regulation.

If that's not what they are, then...what voltages are present? Any voltage higher than what an input is intended for can damage/destroy the parts connnected to it (battery voltage is just so much higher it's virtually guaranteed)
 
So would the screen still work if i have the PL and P+ SWAPPED?
Likely not. iirc. P+ is battery voltage, and PL is the input for "turn the controller on".
I suppose that would be easy to verify with the adapter for programming, as it should
have those shorted to turn the controller always on whenever battery power is available.
 
accidentally shorting the P+ and rx pins when I was trying to straighten after a new stiff connector met my soft brittle harness!!

Likely not. iirc. P+ is battery voltage, and PL is the input for "turn the controller on".

so Pl is the voltage line.....
the p+ is the 5v line to power the screen.
So per the quotes above, this means that hte rx line is almost certanly damaged, having had battery voltage connected to it.

That means that whatever that RX line is part of (display or controller) is probably no longer able to receive data from the other (at all, most likley, but reliably, otherwise).

If tha'ts the display, it can't get info from the controller to show on the display. You'd get voltage because tha'ts measured inside the display, but no speed, power, etc.

If tha'ts the cotnroller, it can't get info from the dipslay to tell it what to do--you can't set assist levels, or anything else that the display has to tell the controller to do.


If the P+ and PL are both battery level voltages, and are swapped, no damage occurs, but the display won't get any power so it can't switch taht power to turn on the controller. It gets power from one line that comes from the controller that's always connected to battery+, and when you press the power button on the dipslay the display turns a transistor on that sends that back to the controller over the other wire to power the ocntroller's low voltage power supply that turns it's brain on, powers halls and throttle and pas / etc.
 
I've successfully flashed 5 bbs02s and all went well with great results. Today I flashed a friends... the flashing went well...but when I turned it on I got an error 10 'motor overheat'. The motor was stone cold so I knew that wasn't the real issue. I was able to ride the bike but the response wasn't right, like maybe it was in limp mode.

I got back in the config tool and noticed I could disable the temperature sensor, so did that and then the bike was great, just as good as all the others I had done.

I'm assuming there is either a fault with the temperature sensor or this is just some strange issue with the firmware. I'm inclined to think the former as all the others I have done have been fine with no errors thrown.

My question is, if there is a problem with the temperature sensor why wasn't it an issue with stock Bafang firmware?
 
Did you look at the temperatures from event log while connected to it with the tool used to configure it?
It should show 0 for motor on bbs02, so only the controller temperature is relevant.

Stock bafang firmware is what it is - written by chinese, who are known to cut corners.
 
Did you look at the temperatures from event log while connected to it with the tool used to configure it?
It should show 0 for motor on bbs02, so only the controller temperature is relevant.
No, but that's a good suggestion. I'll check next time I'm over at my friends
 
iirc., the change does bring smoother throttle by default, and it's not even configurable from the tool.
Personally i use the new default, while i did use the quadratic for a long while before 1.5 i just like the custom map even more.

So, it's hard to go wrong when both options are smoother than the linear response 1.4 had.
I wasn’t able to see
iirc., the change does bring smoother throttle by default, and it's not even configurable from the tool.
Personally i use the new default, while i did use the quadratic for a long while before 1.5 i just like the custom map even more.

So, it's hard to go wrong when both options are smoother than the linear response 1.4 had.
I can’t see any new quadratic throttle options in 1.5.0 version.
 
Hello. Today I installed your firmware. So far I like the result. Tomorrow I will test it to the fullest extent. The only thing that confuses me is that my controller shows a voltage of 59.9 V with my battery 52 V. What should I believe?
 

Attachments

  • IMG_5997.jpeg
    IMG_5997.jpeg
    818.1 KB · Views: 10
Hello. Today I installed your firmware. So far I like the result. Tomorrow I will test it to the fullest extent. The only thing that confuses me is that my controller shows a voltage of 59.9 V with my battery 52 V. What should I believe?
Config tool -> Calibration tab, did you fill it/calibrate the voltage there ?
System-tab also has "Max Battery Voltage", which you should set to 58,8 volts.

100% state of charge == 4,2 volts per cell X 14 cells in series for a 52 volt nominal battery
== 58,8 volts

59,9 volts is well within the margin of error(2V) w/o calibration.
 
Back
Top