Skip to main content
Firmware Stable

Balancing states

info
  • All mentioned variables are located in folder /driver/balancing/.

Balancing configuration

Balancing is allowed in states IDLE and greater. In the OVERVOLTAGE state, balancing is forced regardless of the balStartDelta parameter (the delta is treated as 0), to discharge the highest cells as fast as possible.

Balancing is automatically disabled when:

  • The balancer is overtemperature (balState bit 2 - see temperature limitation)
  • Any cell is in undervoltage (balState bit 8)
  • The cell check failed or the balancer failed (balState bits 16 and 32)
  • A cell voltage is less than 200 mV above the cellMinVoltage threshold (that cell is excluded from balancing)
ParameterDescription
cellBalVoltageIf voltage of cell is above this value, balancing of that cell is allowed.
balStartDeltaIf the difference between the highest and lowest cell voltage is above this value, balancing is started.
balEndDeltaIf the difference between the highest and lowest cell voltage is below this value, balancing is stopped.
maxSimBalMaximum number of cells balanced at one moment. If there is overtemperature of balancer, the BMS will automatically reduce number os balanced cells.

Balancing states

balCmd

Bit (value)Meaning
1Balancing is enabled (the state machine allows balancing in the current state)
2Balancing is overridden by the balance shell command (ignoring cellBalVoltage and the BMS state)

balState

Bit (value)MeaningCause and consequence
1Is balancingAt least one cell is being balanced right now (see cellBalancePrio). The BMS will not go to sleep while balancing.
2Balancer overtemperatureA balancer temperature sensor exceeded its max threshold. Balancing is paused until the balancer cools down. See temperature limitation.
4Cell overvoltageA cell voltage was above cellMaxVoltage for more than 2 s. The BMS enters the OVERVOLTAGE state. See cell voltage limitation.
8Cell undervoltageA cell voltage was below cellMinVoltage for more than 1 s. The BMS enters the UNDERVOLTAGE state and balancing is disabled. See cell voltage limitation.
16Cell check errorbadCells is non-zero, or the sum of cellVoltages differs from the measured pack voltage by more than 1 V. The BMS enters the FAIL state ("Cell check fail", value 106).
32Balancer failureThe balancer IC stopped responding at runtime (communication problem). The BMS enters the FAIL state ("Balancer fail", value 103) and retries every 5 s.
64Critical undervoltageA cell was below CritUnderVoltage for more than 10 minutes. The BMS enters the FAIL state ("Critical undervoltage", value 104).
128Balancing forcedBalancing was forced manually with the balance shell command (a specific cell bitmask is active).

badCells

Bitwise state which signalizes cells with a connection error (bit index = cell index):

  • If the cell is expected (index below Scount) and its voltage is below 100 mV
  • If the cell is not expected (index at or above Scount) and its voltage is above 100 mV

A non-zero badCells raises balState bit 16 (cell check error) and puts the BMS to the FAIL state. Typical cause: wrong Scount setting or a broken cell sense wire.

*All the states are bitwise

Balancer readings

VariableDescription
cellVoltages[mV] Array of cell voltages.
cellBalancePrioArray of balancing priorities. 0 = cell not balanced, 1 = highest priority (highest voltage), 2 = next ...
cellMin[mV] Minimum cell voltage.
cellMinIndexIndex of the cell with the lowest voltage.
cellMax[mV] Maximum cell voltage.
cellMaxIndexIndex of the cell with the highest voltage.
cellDiff[mV] Difference between the highest and lowest cell voltage.
cellVoltSum[V] Sum of all cell voltages. Compared against the pack voltage by the cell check.