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.
All mentioned variables are located in folder /driver/sleep/.
States
| State | Description |
|---|---|
timer | Sleep countdown timer |
preventSource | Source preventing the BMS from sleeping (positive: hardware, negative: software) |
wakeSources | Wake 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.
| Value | Source | Description |
|---|---|---|
0x0001 | CAN | CAN bus activity |
0x0002 | UART | UART activity |
0x0004 | USB | USB connection |
0x0010 | RTC | Real-time clock alarm (periodic internal wake) |
0x0020 | DSC | Discharge port activity |
0x0040 | CHG | Charge port activity |
0x0080 | DSC_CHARGE | Charging through the discharge port |
0x0100 | BAL_ALRT | Balancer alert |
0x0200 | BAL_UPD | Balancer update |
0x0400 | BAL_SCAN | Balancer scan |
0x0800 | STATE_CHANGED | State changed during sleep |
0x1000 | BTN | Button press |
0x2000 | KEY | Key switch |
0x4000 | CHG_DETECT | Charger detection input |
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
| Command | Description |
|---|---|
awake | Stay awake for a specified duration |