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.

BQ34Z100-G1: Programming .bq.fs using microcontroller, errors in gauge.c demonstration

Part Number: BQ34Z100-G1

Hi,

I'm trying to program the fuel gauge with the golden image using the microcontroller on the i2c bus rather than using battery management studio.

Our bq.fs file is 180k in length, with lines of hex typically having 100 bytes of hex characters per line (this was generated by bq studio)

Example

;--------------------------------------------------------
;Unseal device
;--------------------------------------------------------
W: AA 00 14 04
W: AA 00 72 36
W: AA 00 FF FF
W: AA 00 FF FF
X: 1000
;--------------------------------------------------------
;Go To ROM Mode
;--------------------------------------------------------
W: AA 00 00 0F
X: 1000
;--------------------------------------------------------
;Data Block
;--------------------------------------------------------
W: 16 00 04 00 00 00 83 DE
W: 16 64 65 01
X: 200
C: 16 66 00
W: 16 00 02 00 00 00 EA FF 33 B1 FA 33 6C FB 33 95 FE 33 AD FE 33 FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF.......<102 bytes total>
W: 16 64 1A 37
X: 2
C: 16 66 00
W: 16 00 02 01 00 00 01 4F 03 3F 11 0C D9 FF 30 E0 FF 35 2F 10 0C E0 FF 35 FF FF 23 FF DF 0B D8 FF 33 E3.......<102 bytes total>
W: 16 64 A6 2D
X: 2
C: 16 66 00
W: 16 00 02 02 00 00 FF 1B 0E 96 FF 36 02 AF 18 7F BF 0E 02 CF 02 00 A7 18 01 A6 18 02 AB 18 DF 2B 0E FF.......<102 bytes total>

I have several questions with this format and the example code shown in slua801.pdf.

1) Is the i2c address changed from 0xAA to 0x16 normal when going into ROM mode?

2) The gauge.c parser will fail at the point indicated below as the parser expects a maximum line length of 32 data bytes, pData is an array of 32 bytes. Is the solution just a case of expanding the size of the buffer to allow for the longest line length (increase pData to 100+ bytes?), or is there other work that is required.

pFS++;

n = 0;

while ( ( pEnd - pFS > 2 ) && ( n < sizeof(pData) + 2 ) && ( *pFS != '\n' ) )
{
pBuf[0] = *(pFS++);
pBuf[1] = *(pFS++);
pBuf[2] = 0;
 

Cheers

Glen