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?
- Should my code only include two processes: to configure some parameters and read the registers for capacity?
- 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()”?
- 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);