08 Control State and Troubleshooting - stancecoke/BMSBattery_S_controllers_firmware GitHub Wiki
The control state
If you're having trouble and want anyone to help you on the forum make sure you read and understood the following!
When connecting via BluOSEC or enabling diagnostics the controller reports its state via ui16_control_state. In the BluOSEC App you can watch the state field after swiping vertically over the "Trip monitor" pane which will switch through 3 views, "Trip monitor","Phase/Hall infos" and "Details"
The control state values
Control state is to be evaluated bitwise. If you don't understand what that means, take a look here: https://www.wikihow.com/Read-Binary
When not braking, bits have the following meaning:
- 1 you are in torquesimulation and pedaling slower than ramp end
- 2 you are in torquesimulation and pedaling faster than ramp end
- 4 you are in torquesensor mode
- 8 throttle / torquesensor factor is influenced by assist level
- 16 throttle / torquesensor currently overrides torque simulatiom / cadence
- 32 overspeed ramp down
- 64 max battery current limiting
- 128 phase current limiting
- 256 ui32_dutycycle is set to zero via ui16_aca_experimental_flags (experimental, dangerous, only for finding the correct motor angle while turning the wheel by hand)
- 512 experimental PWM power off is enabled
- 1024 motor speed to high (erps higher than erps limit)
- 2048 undervoltage
- 4096 overvoltage
Example: 34 is 32+2 meaning you are:
- in torquesimulation and pedaling faster than ramp end
- overspeed and power output is being ramped down
When braking, bits have to be subtracted from 255 and have the following meaning:
- -1 digital regeneration is activated
- -2 analog regeneration (via x4 throttle) is activated
- -4 speed influences regen is active and regen is ramped down below speed threshold
- -8 regen is being optimized @ low speed (only tested with BionX IGH)
There is the tool OSEC State Translator in the repo, that helps to unterstand the state code.