BMS Selftest¶
The Selftest is a diagnostic application designed to verify the functionality of various hardware components and peripherals in the BMS project. It can be used during all stages of battery pack production:
- As pre-integration test, before adding the PCB to the cell pack
- During integration, to quickly check if all cell pack connections are good
- After integration, driving the end-of-line test of a battery pack
Usage¶
Pre-Integration Test¶
Make sure the device under test is programmed with the selftest application. Leave the BMS disconnected from any load and power it on.
First, you should see the LED self test sequence on the LEDs. After this is complete, the LEDs will show progress and result of each test group:
- 🟢 solid green: Test successful
- 🟡 solid yellow: Test skipped
- 🔴 solid red: Test failed
- ⚪ white: Test pending for execution
- 🟢<->🔵 turquoise blinking: calibration active, please wait
- âš« black: maybe LED not functional
After the first run of the test sequence, connect the test fixture to the BMS, restart the test sequence by pressing the button.
| Setup | Display |
|---|---|
| Disconnected | 🟢🟢🟡🟢🟢 |
| Test Fixture | 🟢🟡🟢🟢🟢 |
Should the LEDs not look like in the table above, at least one test has failed. Connect the console, re-run the tests, and copy the console log output to a new Notion issue.
Test Cases¶
The tests are grouped into five groups, of which three are currently implemented.
| Group | Description |
|---|---|
| T1 | Internal Tests |
| T2 | Tests with disconnected pack |
| T3 | Tests with BMS Test Fixture |
| T4 | Cell Pack Tests |
| T5 | Cyphal/CAN Tests |
After execution of all test cases, the Selftest application will turn off after 60s.
T1: Internal Tests¶
The internal tests are independent of the external environment and can be run at any time. There are no expectations regarding power stage state, cell voltage connections or temperature sensors, external pack connections or Cyphal network presence.
These tests do not activate or deactivate the power stage, meaning it is safe to run these tests with some kind of load connected.
T1.1: Internal Measurements¶
The following voltages and temperatures are measured and checked against expected ranges:
| Quantity | Minimum | Maximum |
|---|---|---|
| VBAT | 12.0 V | 25.2 V |
| VCC | 3.25 V | 3.35 V |
| 3V3 | 3.25 V | 3.35 V |
| VREF | 2.95 V | 3.05 V |
| Core Temp | 15.0 °C | 45.0 °C |
| BMS Temp | 15.0 °C | 45.0 °C |
In addition, the difference between the highest and lowest temperature sensor reading should not be more than 5 Kelvin.
T1.2: LEDs¶
All LEDs are switched on and off in sequence, and the current consumption of each LED is measured. When an LED's current consumption is within 20% of its expected value, the LED can be considered working.
T2: Tests With Disconnected Pack¶
The tests in this section are run with an idle pack. Both the pack and signal connections should be disconnected.
âš ATTENTION: During these tests, the pack will be activated multiple times. Do not run with a load connected, and make sure the pack output is isolated!
T2.1: External Inputs¶
This test simply verifies that the BOOT pin reads as disconnected, and that the analog key reads as open/disconnected.
T2.2: Hot Swap Controller¶
The hot swap controller is enabled, and the pack voltage is expected to rise monotonically. Pack voltage should rise monotonically to the internal battery voltage, with the current not exceeding 50 mA.
Outdated: The HS_OK pin is expected to go high after the precharge sequence is complete.
Voltage of pack and bat are (near) equal after sequence is complete.
T2.3: Power Stage¶
The pack performs a regular precharge sequence, and ensures the measured (HS controller) current is close to zero. The pack is then engaged by enabling both transistor latches and disabling the HS controller. The pack voltage is expected to stay constant, indicating the FETs have properly turned on.
The CHG transistor is then disabled, and the pack voltage is expected to drop by the transistor body diode's forward voltage. Finally, the DSG transistor is also disabled, and the pack voltage is expected to drop to (or close to) zero.
T2.4: Short Circuit Protection¶
The pack normally performs a precharge and engages the power stage. The short circuit protection circuit is then tested by crudely shifting the current limit threshold to below the current sense amplifier offset voltage. The comparator output should go high, and the CHG and DSG latches should deactivate.
T3: Tests With BMS Test Fixture¶
The tests in this section are run with the BMS Test Fixture connected. The fixture contains a 55 Ω load, which will lead to a load current of 450 mA with a fully charged pack.
T3.1: External Inputs¶
Like with T2.1, this test verifies the boot pin state and analog key circuitry. With the test fixture attached, the boot pin should read as connected, and the analog key should indicate copter slot 2.
T3.2: VBUS Active¶
The VBUS active detection circuit is tested by first ensuring VBUS is not present, then enabling the pack and checking if VBUS is detected.
T3.3: Power Stage¶
This test is very similar to T2.3, but with the BMS Test Fixture connected. During precharge and while being engaged, the current is expected to be close to VBAT / 55 Ω.
T4: Cell Pack Tests¶
Uses the BQ7... chip to do cell pack related analog measurements.
T4.1: Pack Voltages¶
Measures the cell voltages
T4.1: Pack Open Wires¶
Detect and indicate open wires
T4.1: Pack Temperatures¶
Check the Cell Temperatures / the BQ temperature
T5: Cyphal/CAN Tests¶
Wait for a heartbeat, listening on the CAN interface. Upon one message is received the test is passed. Else, a timeout of 3s is awaited and the test fails.
Calibration¶
The Selftest performs a fast calibration (10s measurement) before first execution to improve the analog measurement quality. The calibration determines the gain for vbat & vpack and the ibat offset by a voltage / current measurement with enabled latches (vbat = vpack assumed) or disabled latches (no current assumed; ibat = 0).
A more precise measurement (130s measurement) is available after test execution by pressing the button for at least 3s (long button press). Alternatively, this precise calibration can be started from the shell (see below).
Shell¶
A shell is available after test execution.
The shutdown timer is reset every time a command (of the bms command group) is executed.
The shell adds the bms command group with following subcommands:
initializemounts the flash partition (formats it if new), adds (empty values) registers to the registry (RAM)defaultssets data to current best values (default values from compiled app)clearpurges the data on the flash partitionlistshows the registers in the registrydumpshows the values of the registers in the registryset <param> <value>sets a register in the registryget <param>returns the value of a register in the registrycommitsaves the current registry and data to the flash partitionloadloads the current registry and data from the flash partitioncalibrateexecutes the precise calibration process
Example commands¶
bms defaults -> bms set board.hardware.pack_set_id "1fe0" -> bms commit