EV2400 Reimplementation for Raspberry Pi Pico
A Rust-based reimplementation of the Texas Instruments EV2400 hardware interface using the Raspberry Pi Pico (RP2040). It enables communication with TI battery gauge ICs via I2C and GPIO using the Embassy async framework, allowing the Pico to act as a bridge for TI's Battery Management Studio.
Overview
The EV2400 is a proprietary hardware interface device from Texas Instruments used to interface PCs with battery gauge ICs and other specialized hardware. This project provides a functional reimplementation of the EV2400 using the Raspberry Pi Pico (RP2040). By leveraging the Rust programming language and the Embassy asynchronous framework, it transforms an affordable microcontroller into a tool capable of communicating with TI’s official Battery Management Studio software.
While the implementation is described as “quick and dirty” due to the lack of official documentation on the EV2400’s wire format, it successfully implements the core USB HID protocol required for the PC to recognize the device. This allows developers and hobbyists to interface with battery management systems without requiring the official, often more expensive, TI hardware.
Key Features
- USB HID Emulation: Mimics the official EV2400 device signature, allowing it to be detected by TI’s Battery Management Studio.
- I2C Support: Provides a bridge for I2C communication, tested specifically with the BQ27427 gauge.
- GPIO Control: Supports multiple GPIO outputs for hardware signaling.
- Async Architecture: Built on the Embassy framework, ensuring efficient handling of USB and peripheral I/O.
- High-Efficiency Logging: Uses the
defmtframework for deferred logging, which is critical for debugging USB timing issues without losing early boot logs.
Technical Implementation
The project is written entirely in Rust, targeting the RP2040 microcontroller. It utilizes the Embassy ecosystem for its runtime and hardware abstraction. The use of asynchronous programming is particularly beneficial here, as it allows the firmware to manage complex USB HID requests while simultaneously handling I2C transactions and GPIO states without blocking.
Hardware Pin Mapping
The firmware maps specific RP2040 GPIOs to EV2400 functions. Users should note that the Pico operates at 3.3V logic levels; if the target hardware uses a different voltage, a level shifter is necessary to prevent damage.
| Pico Pin | GP | Function |
|---|---|---|
| 11 | 8 | I2C SDA |
| 12 | 9 | I2C SCL |
| 14 | 10 | GPIO 1 |
| 15 | 11 | GPIO 2 |
| 16 | 12 | GPIO 4 |
| 1 | 0 | Defmt Debug Logger |
Development and Deployment
For end-users, deployment is straightforward: the project provides a UF2 firmware file that can be flashed by dragging and dropping it onto the Pico in BOOTSEL mode.
For developers, the project includes a comprehensive build environment. It uses cargo for dependency management and elf2uf2-rs for generating flashable binaries. Debugging is optimized for use with a BlackMagic probe, and the defmt logging system is routed through a dedicated serial pin (GP0) to ensure that USB resets during development do not interrupt the flow of debug information. This setup is ideal for those looking to extend the project’s capabilities, such as adding SMBus or HDQ protocol support.