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.

bq27741 i2c communications issue

Other Parts Discussed in Thread: BQ27741-G1

I have some basic questions about I2C with a bq27741-g1.  

To read temperature, for example, the users guide says to use the 2-byte command code "0x06 and 0x07".  Is this MSB and LSB, or LSB and MSB   Will the response be MSB or LSB first?

To access the Control commands, the command code is listed as "0x00 and 0x01"    When attempting to read the firmware version, I write 0x00 0x01, follow with a write of 0x02 0x00, wait ~66uS, and read 2 bytes.  I read 0x00 0x19.

I'd appreciate any guidance.

Steve

  • Hi Steve,

    I would encourage you to get an EVM if you don't have one..it will tremendously help your learning curve when using the gauge. See response to a similar question i sent to a customer making similar inquiries to yours.

    You have two commands to be able to read the entire 2 byte of data whose max size in dec could be 2^16=65536, in hex :0xFFFF

    Eg to read voltage the command is 08/09

     

    I only need to read 2 bytes from command 08. If you send command 09, you will be reading the second byte of the voltage. See example below using our GUI where I am reading the voltage which is 3620mV. Reading 2 bytes using command 08 gives the full voltage value 0x0E24. 09 only gives the second byte i.e 0E. Note that the results is little endian so the value returned is 0E24 which is hex for 3620

     

    Let me know if this helps.

    thanks

    Onyx

    Onyx

  • I believe a coworker has an evm on order.

    That helps tremendously, Onyx. Thanks. I'm able to read temperature values that make sense.

    I still have a problem reading the control registers, though. Writing 0x00 for control, then writing 0x0200 for the firmware version, waiting ~66uS before a two byte read doesn't produce 0x0105. Rather, the raw data is 0x0017. Similarly, using 0x0100 for the control address gives 0x0000 for device type.


    Steve
  • Writing subcommands are a little different from the standard commands.

    You need to write to the control register, then issue the command, then read from the control register and address as shown in the snippet below from the TRM:

    if 66us time doesn't work, increase the value to 100us, Try different timing until you get something that works all the time.

    Using the gui, i was able to read the firmware version which is 329

  • Onyx,

    Might you have a logic analyzer trace reading a control value such as firmware version? 

    I've been trying several different delays with no result.  

    Steve

  • Never mind, Onyx.  Thanks for your help.

    For anyone else having similar issues, here is a successful read of device type, another control sub command.

  • thanks for Sharing, Steve, i didn't have a logic analyzer and was checking with other labs here to see if i could lay my hands on one.
    regards
    Onyx