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.

BQ40Z80: Trouble reading registers

Part Number: BQ40Z80
Other Parts Discussed in Thread: EV2400, BQSTUDIO

Hello,

I am trying to read basic registers like the Device Name from the BQ40Z80.

When I send a burst of I2C messages to addresses 0x00 to 0x7F, I get a response from 0x0B if the battery is connected. If I understand correctly, 0x0B is the 7-bit truncated version of the expected default 0x16 address?

The real question is, how do I interface with the device. I have tried sending 0x21 to 0x0B, but I am not getting a valid response.

Surely I'm overlooking something trivial, but I would appreciate some feedback!

  • Hello,

    The BQ40Z80 uses SMBus communication which operates differently than I2C.

    You can review this document to see some of the differences between the two communication methods: https://www.ti.com/lit/an/sloa132/sloa132.pdf

    The problems you are encountering may be related to the protocol used.

    Sincerely,

    Wyatt Keller

  • Hi Wyatt,

    Thank you for your response.

    I'm aware that SMBus is a variant of I2C, but I don't see where I made the mistake. Another SMBus chip is responding just fine with comparable code.

    Previously, I was trying to read the Device Name, but now I'm just following the example from the BQ40Z80 TRM. This resulted in this code:

    char deviceName[16] = "";
    uint8_t cmd[] = { 0x44, 0x02, 0x06, 0x00 };
    I2C_write(0x16, cmd, sizeof(cmd));
    i2c_write_read(i2c_dev, 0x0b, cmd, 1, (uint8_t *) deviceName, sizeof(deviceName));
    for (uint8_t i = 0; i < 16; i++)
    {
        printk("0x%02X, ", deviceName[i]);
    }

    So I'm sending an SMBus block of 0x44 CMD, 0x02 Length, 0x06 0x00 data, followed by a SMBus block read: write 0x44 CMD, followed by a read.
    However, the result is wrong, as can also be seen in the logic analyzer:

    Any hints?

  • Hello,

    I would recommend you use bqStudio and an EV2400 to capture the communication using the advanced comm to send the transaction like you are doing or the commands tab to see if they match what you are trying to implement.

    Sincerely,

    Wyatt Keller