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.

BQ76952: Problems Programming Calibration:Current:CC Gain Register

Part Number: BQ76952
Other Parts Discussed in Thread: BQSTUDIO

Hi,

My board is using a PIC32 microprocessor to configure/talk to the BQ76952 over I2C. 
I'm able to enter configuration mode and set all of the data memory as I would like except for the CC Gain/Capacity Gain registers.

I'm assuming this has something to do with them being the only floating point registers I'm setting, but two questions:

  1. Our board has a 0.008Ohm sense resistor.  Should I be entering 8.000mOhm into this register, or is the register value supposed to be set according to this equation:
    So in this case, 7.5684/8.000 = 0.94605/mOhm ?
  2. My I2C functions currently work with integer values, so I've been converting my floating point numbers into hex representations in order to simplify my code. So far, I've been trying to write the register with the value 8.000, and converting this to hex I get 0x41000000.  But when I write this across to the BQ via the PIC and then connect to the BQ via BQStudio, the register reads 1.012mOhms.  I've also tried other hex values and keep getting this 1.012mOhm number, so I'm not sure what I'm doing wrong as I'm able to write all my other register settings correctly.

Thanks

  • Hello Nathan,

    The CC Gain and Capacity Gain are encoded in 32-bit IEEE-754, so you should be converting the decimal value you get from the formula into the IEEE-754 format.

    The gain has no units. So CC Gain = 7.5684/8 = 0.94605, this is what you would input in the register, using an IEEE-754 calculator I found online, I get the following Hex value:

              CC Gain = 0x3F723055.

              Capacity Gain = 0.94605*298261.6178 = 282170.40351969 = 0x4889C74D.

    bqStudio does the conversions automatically, 1.012mOhms reading from bqStudio sounds like the default value for the register, so for some reason you are not correctly writing to it.

    Is your checksum and length correct? It may be worth getting a logic analyzer and seeing what is being sent.

    Best Regards,

    Luis Hernandez Salomon

  • Hi, 

    Thanks for the verification on the numbers I should be using. Was just getting kind of confused because BQStudio showed a unit on that field but was also showing that equation which wouldn't have a unit.

    Looking at the data via logic analyzer, nothing is immediately jumping out to me as being wrong, maybe you'll notice something that I'm not?

  • Hello Nathan,

    Yes, I do see what is wrong. The checksum is incorrect, this should be 0x90, not 0x41. I was able to write to the CC gain with the following sequence (Done in the command sequence of bqStudio):

    W: 10 3E 90 00                      - Enter CONFIG_UPDATE mode
    W: 10 3E A8 91 55 30 72 3F - Write 0x3F723055 to CC Gain.
    W: 10 60 90 08                      - Checksum of 0x90 (Based on A8 91 55 30 72 3F) and length of 08
    W: 10 3E 92 00                      - Exit CONFIG_UPDATE mode
    I confirmed it was properly configured to 8-mOhms by reading the register window in bqStudio.
    Best Regards,
    Luis Hernandez Salomon
  • Yep, you're right. Didn't realize my checksum function was only working for 2 bytes of data.  Thanks!