We know that it's tough to talk to the fuel gauge chip on the Fuel Tank BoosterPack. Its I2C interface is sensitive to right timings.

The Dangerous Prototypes Bus Pirate is famous for its sturdy communication prototyping capabilities. Before I test the Fuel Gauge IC in my own design, I want to test out the communication, and capture some question-reply sequences with a logic analyzer.

 

 

In this first post I tried out the I2C communication with a Bus Pirate.

This time I will capture some communications and store them for later use. I'm abusing the blog for my own documentation purposes .


Capture Time


papilio logic_analyzer i2c fueltank_boosterpack


Capture 1: Simple Query with Constant Reply


First I'm going to capture a conversation that's predictable and repeatable.

Design Capacity is a value that's always returning the same reply. That's an ideal candidate to capture for later comparisons.


I2C>[0xaa 0x2e [0xab rr ]
I2C START BIT
WRITE: 0xAA ACK
WRITE: 0x2E ACK
I2C START BIT
WRITE: 0xAB ACK
READ: 0xB0
READ:  ACK 0x04
NACK
I2C STOP BIT
I2C>


 


Capture 2: More Complex Control Query

 

Number two is a conversation that requires a second start. We're firing a control question.

That's a two-step communication. First put the bq27510 in control state, then restart the communication with a control query.

We're asking the firmware version. That's again an example that's easy to verify later when we're replacing the Bus Pirate with a microcontroller.

 

I2C>[0xaa 0x00 0x02 0x00] [ 0xaa 0x00 [0xab rr ]
I2C START BIT
WRITE: 0xAA ACK
WRITE: 0x00 ACK
WRITE: 0x02 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C START BIT
WRITE: 0xAA ACK
WRITE: 0x00 ACK
I2C START BIT
WRITE: 0xAB ACK
READ: 0x00
READ:  ACK 0x04
NACK
I2C STOP BIT
I2C>


 

 

 

Capture 3: Query with a Variable Reply


The last communication is one where the reply is dependent on the condition of the battery.
We ask the state of charge. We'll get the charge level back as a %.


I2C>[0xaa 0x20 [0xab rr ]
I2C START BIT
WRITE: 0xAA ACK
WRITE: 0x20 ACK
I2C START BIT
WRITE: 0xAB ACK
READ: 0x63
READ:  ACK 0x00
NACK
I2C STOP BIT
I2C>


 

 

The 3 OpenLogic projects and exports of the captured data are attached to this blog.

 

Related Posts
part 1: Communication Test with a Bus Pirate
part 2: Capture Test Communication with a Papilio
part 3: First Attempt with Hercules LaunchPad