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.

BQ27541 communication

Other Parts Discussed in Thread: BQ27541, BQ27541-V200, BQ34Z100

Hello,

I am using the BQ27541 in HDQ mode and am having trouble with some of the data that is returned.

I can read the voltage and temperature fine.  SOC always returns 0 and SOH always returns 89.

Thinking I might have to do some sort of reset or calibration, I tried to figure out the 'Control' functions.  I cannot figure out how to send and receive Control function data.

Note that I am bit banging the HDQ line from an MSP430 device.

Question is twofold:
a) why would I be getting good data from VOLT and Internal Temperature, but bad data from everything else?

b) what is the communication sequence to read and write the 'Control' functions?  The data sheet is of no help here. (for example, to read Voltage, I send 0x09, read most significant byte, send 08, read least significant byte.  How would I read and write to the control functions?  Note that I have verified my HDQ bit timings)

Thanks,

Mark Rush

  • Hi everybody,

    I have exactly the same problem as the one Mark explained in this post. I can correctly get (read) the voltage, time to full battery etc.
    As soon as I try to use Control command I always receive 0x1414 response whatever I try to read among the parameters allowed by this function...

    Mark did not received any answer to his question last summer, did anybody found something about this?

    (Note also that I have verified my HDQ bit timings)

    Thanks to everyone

    Best Regards

    Julien Marie
  • Hi Julien,

    Welcome to the forums!

    What specific bq27541 are you using, like the bq27541-V200, -G1, etc.? Also, is this for a development/test setup or for connecting to a device already in production? If it's from a product that's already in production (as in you're servicing a returned battery pack, for example), the fuel gauge may be sealed, which will block several CONTROL commands.

    As for the usage of the CONTROL subcommand, here is some rough C code that should explain the procedure of sending a command and reading back the gauge's response (this is assuming that the underlying low-level code to read and write to the HDQ bus is functioning correctly):

    unsigned short hdq_control_command(unsigned short command)
     {
       unsigned char in_high, in_low; // These 2 bytes will hold the gauge's response
    
       write_hdq_byte(0x0,command & 0xff); // Write low byte to HDQ address 0x00
       write_hdq_byte(0x1,(command >> 8) & 0xff); // Write high byte to HDQ address 0x1
    
       Delay(0.01); // Wait for gauge to process command
    
       in_high = read_hdq_byte(1); // Read back high byte from HDQ address 0x01
       in_low = read_hdq_byte(0); // Read back low byte from HDQ address 0x00
    
       return (in_high << 8) | in_low; // Reassemble gauge's response
     }

    I'm no programmer but hopefully this should get you on the right track!


    Cheers,

    Jason

  • Hi Jason,

     I could solve the problem with the Control command. Could you help me out with measuring the voltage, SOC?

    Are there sample codes for BQ34Z100?

    Thank you

    Sunil Sreedhar

  • Hi Sunil, welcome to the forums!

    Are you trying to communicate with the bq34z100 in HDQ mode? Regardless of whether you're reading from HDQ or I2C mode, the process is pretty simple. Reading registers (formally known as standard commands) doesn't require a write like a Control() subcommand. For example, to read the Voltage register, just read from addresses 0x08 and 0x09.

    I haven't done much personal testing with the bq34z100 in HDQ mode, but accessing TI gauges is usually very similar between chip models.

    Here's a little sample code snippet to read a 16-bit register:

    unsigned short hdq_read_register(unsigned char register_id)
      {
        unsigned char in_high, in_low; // These bytes will hold the register data.
        
        in_high = hdq_read_byte(register_id+1); // High byte (register ID + 1)
        in_low = hdq_read_byte(register_id); // Low byte
        return (in_high << 8) | in_low; // Reassemble gauge response into 16-bit word
      }

    Using that sample code, to read the Voltage register, you would use hdq_read_register(0x08). To read the State of Charge, use 0x2C.

    Regards,
    Jason