This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ27220: how to get the gaugingstatus

Part Number: BQ27220
Other Parts Discussed in Thread: BQSTUDIO

I try to get the gaugingstatus refer to manual, but I don't get the value correctly. my  sourcecode like below, please tell me where is wrong in my sourcecode.

write(0xAA)  // I2Caddress

write(0x00,0x56,0x00) // write  gaugingstatus subcommand

wait(2ms)

write(0xCE)  //try to get writeen subcommand

read(2byte)

wait(2ms)

write(0x40) //try to get the gaugingstatus value

read(2byte)

wait(2ms)

I can get the  subcommand(0x0056) correctly by [0xCE] ,

but I can not get the gaugingstatus value correctly by[0x40] 

  • I'm not sure how your write() function works so I don't think I can solve this for you on a code level.

    Here is what you need to do to read the gauging status:

    1. write 0x56 0x00 to I2C registers 0x00/0x01

    2. read two bytes from I2C register 0x40++

    You can try this with advanced comm in bqStudio first.