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.

how to code BQ27441-G1 with TM4C123

Other Parts Discussed in Thread: BQ27441-G1

dear all,

I have problem with BQ27441-g1 for fuel gauge.

Mcu: TM4C123(LM4F232)

Function: battery fuel gauge

I have noted from the SLUUAP7 that there are two chapters: programming the configuration, Reading the gauge registers. But how can I write code to realize my function?

  1. Should my code only include two processes: to configure some parameters and read the registers for capacity?
  2. To configure the parameters, how to code it? I have noted that there are some commands. The commands are two bytes. What’s the c code of “I2CWriteWord()”?
  3. To read the registers for capacity, my code does not work right and the I2c2ValueGet1 is 0. What’s the problem?

thanks very much!

I2CMasterSlaveAddrSet(I2C2_BASE, 0x55, false);  //0101 0101  true-receive

I2CMasterDataPut(I2C2_BASE, 0x0c); //0c is the command code of RemainingCapacity()

I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_SINGLE_SEND);

I2CMasterSlaveAddrSet(I2C2_BASE, 0x55, true);

I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_RECEIVE_START);

 I2c2ValueGet1 = I2CMasterDataGet(I2C2_BASE);

 

  • is there anybody know it? thanks very much!
  • Hey Dannel,

    To read the registers you need to first issue a write command, with the address of the register you want to read. This is the standard format to communicate with any I2C device, like our gauge.

    Please refer my code: github.com/.../gauge.c

    I have been able to read the register values, this means parameters like voltage, current, SOC etc.

    What I havent been able to verify is whether it is possible to update the parameters like design capacity, and terminate voltage, referred to as configuration of gauge. I have coded the steps in the config_gauge function, but it is not giving satisfactory results.

    To post doubts related to my code, use the github issues.

    Let me know if you made any progress

    - Chintan Pathak