element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs I2C with Fuel Tank BoosterPack - part 1: Communication Test with a Bus Pirate
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 16 Aug 2015 7:16 PM Date Created
  • Views 1213 views
  • Likes 2 likes
  • Comments 3 comments
  • i2c
  • bq27510
  • fuel_gauge
  • bus_pirate
  • fuel_tank_boosterpack
  • texas_instruments
  • fueltank_boosterpack
Related
Recommended

I2C with Fuel Tank BoosterPack - part 1: Communication Test with a Bus Pirate

Jan Cumps
Jan Cumps
16 Aug 2015

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.

 

 

image

 

In this first post I will try out the communication via I2C, and I'll list some Bus Pirate commands that you can re-use for your own tests.
I'm using a Bus Pirate 4 - but this exercise works equally well with a 3. Just take care that you use the Pirate v3 Reference card for the connections instead of the one for v4 below.

 

 

 

The picture below shows which 3 of the 12 probes we need to use.

image

 

And this picture shows where the corresponding signals are on the BoosterPack.

image

The pull-ups are already available on the board (as long as we keep JP3 in place. We can just connect ground, data and clock.

The Fuel Gauge chip is a Texas Instruments bq27510-gx. The I2C commands are listed in the datasheet. There's also a dedicated I2C communication guide for it.

 

To test the commands, navigate through the Bus Pirate and enable the hardware I2C mode, 100 kHz. (m - 4 - 2 - 1).

image

 

We'll first try an easy command: how much energy left in the battery (in %):

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

 

We get back 0x00 / 0x62. That's 98% in the decimal world.

 

The second command is a bit more elaborate. We'll read the firmware version. That is a control command and requires that we put the IC in control command mode first.

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>

 

We get back 0x04 / 0x00 -> Version 4.0

 

Here's a list of Bus Pirate commands that I forged together and may be of help:

 

 

Simple commands

 

Check voltage

[0xaa 0x08 [0xab rr ]

result / 1000


Check temp

[0xaa 0x06 [0xab rr ]

result / 10 - 273

 

Cycle count

[0xaa 0x1e [0xab rr ]

result

 

state of charge

[0xaa 0x20 [0xab rr ]

result in %

 

DesignCapacity

[0xaa 0x2e [0xab rr ]

result in mAh

Control commands and more elaborate examples

 

CONTROL_STATUS

[0xaa 0x00 0x00 0x00] [ 0xaa 0x00 [0xab rr ]

 

 

028D 1010001101

 

DEVICE_TYPE

[0xaa 0x00 0x01 0x00] [ 0xaa 0x00 [0xab rr ]

 

Data Flash Version code

[0xaa 0x00 0x1f 0x00] [ 0xaa 0x00 [0xab rr ]

 

FW_VERSION

[0xaa 0x00 0x02 0x00] [ 0xaa 0x00 [0xab rr ]

 

HW_VERSION

[0xaa 0x00 0x03 0x00] [ 0xaa 0x00 [0xab rr ]

 

Read multiple items: v, t , version

[0xaa 0x08 [0xab rr ][0xaa 0x06 [0xab rr ][0xaa 0x00 0x02 0x00] [ 0xaa 0x00 [0xab rr ]

 

 

The project has been on the backburner for a while - the video below is more than a year old - but that's how things go sometimes.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

In a next installment, I'll capture the traffic with my logic analyzer.

 

 

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
  • Sign in to reply

Top Comments

  • DAB
    DAB over 10 years ago +1
    Nice blog Jan. DAB
  • modalpdx
    modalpdx over 10 years ago +1
    Posts like this one remind me that I need to learn more about my Bus Pirates (I have a professionally built v3.6 BP and I built my own v4.0c BP). They're pretty amazing little tools, yet all I've done…
  • Jan Cumps
    Jan Cumps over 10 years ago in reply to modalpdx

    Yes, it's a little gem to figure out protocols.

    The scripting options allow me to try out communication scenarios until I get a meaningfull reply from an IC.

     

    I can than capture a known working data exchange. That's very usefull when the IC is not replying as expected when developing firmware.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • modalpdx
    modalpdx over 10 years ago

    Posts like this one remind me that I need to learn more about my Bus Pirates (I have a professionally built v3.6 BP and I built my own v4.0c BP). They're pretty amazing little tools, yet all I've done with mine is dabble with EEPROMs.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Nice blog Jan.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube