Quantcast
Viewing all articles
Browse latest Browse all 35901

Failing to write block data to NVM on BQ27425

I am having mostly great success with the BQ27425 on my board.  The things I can do successfully include:

- Read all of the RAM registers and get correct readings (e.g. battery voltage).  I can also read the sub-command areas of the CONTROL command.

- Configure the block data interface so that I can read the block data (e.g. the gas gauge data).

So everything works pretty well, except I cannot write data to the NVM.  Here's what I do:

- Write 0x00 to command 0x61 (enables block data access)

- Write 0x52 to register 0x3e (selects class 80, gas gauging)

- Write 0x00 to register 0x3f (selects data block 0)

- Read 32 bytes starting from register 0x40.  These bytes match the default values shown for the gas gauge data in the datasheet.

- Read the checksum at register 0x60.  This value matches the checksum I calculate from the bytes I read in the step above.

- I modify a single 8-bit value of the 32 8-bit values I previously read starting from register 0x40.

- I again write 0x00 to register 0x61, write 0x52 to register 0x3e, and 0x00 to register 0x3f again.

- I write all 32 bytes back starting at register 0x40.  This seems to work properly.

- I write the new checksum I have calculated to register 0x60.  This write succeeds, but the data does not get transferred to flash.

- I can change that final step (writing the checksum) so that it attempts to write an *invalid* checksum to 0x60.  If I do this, the transaction fails on an I2C error returned by the BQ27425.  This makes me pretty sure I have the correct checksum.

As a note:

- The VOK bit in the CONTROL_STATUS register is set.

- The SS bit in the CONTROL_STATUS register is clear.

Can you please let me know what the data may not be getting written to the NVM?


Viewing all articles
Browse latest Browse all 35901

Trending Articles