Skip to main content
Firmware Stable

Sleep and wake

The BMS has a low-power sleep mode to minimize battery drain when the system is not in use. During sleep, most peripherals are powered down and the BMS waits for a wake event from one of several configurable sources.

info

All mentioned variables are located in folder /driver/sleep/.

States

StateDescription
timerSleep countdown timer
preventSourceSource preventing the BMS from sleeping (positive: hardware, negative: software)
wakeSourcesWake source history array. The first entry is the source of the last wake

Wake sources

The BMS can be woken from sleep by the following sources. The wakeSources state stores a history of wake events.

ValueSourceDescription
0x0001CANCAN bus activity
0x0002UARTUART activity
0x0004USBUSB connection
0x0010RTCReal-time clock alarm (periodic internal wake)
0x0020DSCDischarge port activity
0x0040CHGCharge port activity
0x0080DSC_CHARGECharging through the discharge port
0x0100BAL_ALRTBalancer alert
0x0200BAL_UPDBalancer update
0x0400BAL_SCANBalancer scan
0x0800STATE_CHANGEDState changed during sleep
0x1000BTNButton press
0x2000KEYKey switch
0x4000CHG_DETECTCharger detection input
note

If the BMS is in the ERROR state, CAN bus wake is disabled. The BMS must be woken by pressing the button before communicating with it.

Sleep prevention

The BMS does not go to sleep while there is a reason to stay awake. The reason is indicated by the preventSource state - positive values are hardware sources, negative values are software sources. The BMS stays awake for example when:

  • Balancing is running (see balancing states)
  • The BMS is in the FAIL state
  • Precharging, discharging, regen or charging is in progress
  • The SOC estimation is updating

Shell commands

CommandDescription
awakeStay awake for a specified duration