This project provides a Rust implementation of the Texas Instruments BQ76952 3‑to‑16‑cell battery monitor and protector.
It is based on TI’s reference documentation, rewritten to use no_std and embedded-hal traits with a mockable I²C interface.
The goal is to expose a safe, typed API for configuration, telemetry, protection, and FET/balancing control.
TI’s BQ76952 uses a command/data‑memory architecture that requires:
- structured subcommands
- checksummed data‑memory writes
- specific sequencing rules
Vendor examples often rely on blocking I²C and manual register handling.
This Rust port provides:
- a
no_stdRust API - safe data‑memory access with automatic checksum
- predictable behavior under concurrency
- compatibility with any
embedded-halI²C backend - a fully testable driver using mock I²C interfaces
The functional behavior matches TI’s reference implementation.
This driver is based on:
- Monitor/Protector: Texas Instruments BQ76952
- Cells: 3–16 series Li‑ion / Li‑polymer / LiFePO₄
- Target MCU: STM32 (or any
embedded-halcompatible MCU) - Interfaces: I²C, ALERT pin, TSx thermistors, FET drivers, cell inputs
The driver uses:
embedded-halfor I²Cno_std- mockable I²C for testing
It exposes:
- register access
- subcommand access
- data‑memory read/write
- voltage, current, temperature telemetry
- protection configuration
- permanent fault monitoring
- FET and cell‑balancing control
- security/unseal handling
- sleep/shutdown mode control
The BQ76952 provides:
- Cell voltages (1–16)
- Stack voltage
- Min/max cell voltage
- Current measurement (CC2)
- Temperatures: internal die, TS1/TS2/TS3, HDQ, DCHG, DDSG
Kelvin‑to‑Celsius helpers included.
Supported protection categories:
- Cell overvoltage / undervoltage
- Charge/discharge overcurrent
- Short‑circuit protections
- Temperature protections
- Permanent Faults (PF)
The driver exposes:
- Safety Status A/B/C
- PF Status
- threshold and delay configuration
- recovery behavior
The BQ76952 supports:
- Sealed
- Unsealed
- Full Access
The driver includes unseal key handling and state tracking.
Supported operations:
- Charge FET
- Discharge FET
- Combined FET control
- Manual cell balancing
Supported:
- Normal
- Sleep
- Shutdown
Driver includes helpers for entering/exiting modes.
The BQ76952 uses a structured data‑memory map with checksums.
The driver provides:
- safe read/write
- automatic checksum
- typed accessors
- raw access for advanced configuration
monitor— full monitoring loop: voltages, current, temperatures, safety status
Run examples:
cargo run --example monitor- BQ76952 Technical Reference Manual
https://www.ti.com/lit/ug/sluuby2a/sluuby2a.pdf(ti.com in Bing) - Datasheet
https://www.ti.com/lit/ds/symlink/bq76952.pdf(ti.com in Bing) - Software Development Guide
https://www.ti.com/lit/an/sluaa11a/sluaa11a.pdf(ti.com in Bing)