Other Parts Discussed in Thread: BQ27421-G1
I am having an issue validating my checksum. First, I would like to say that there seem to be four different ways to perform the checksum calculation, depending on which reference is used. Thus far I have referenced the following documents and performed trial an error with each method, but I am being stopped by an overarching issue (checksum register reads as zero unless I read it two times in a row, in which case I get 0xAC).
- www.ti.com/.../slua790.pdf
- BQ27421-G1 Technical Reference
- Quickstart guide for BQ27421-G1
All of these agree that you need to independently calculate the checksum and then write it to the checksum register before pushing your block memory data to the ROM (I think). However, the first reference seems to think that this calculation can be independent of the previous checksum register value. According to this first reference, you can simply sum the block data address, the data bytes written, invert the sum, and write it to the register. I have tried this and it does not work. This leaves me attempting the other methods, which involve taking the previous checksum register value, inverting it, and sometimes subtracting the old data byte values and doing a mod() to the result, then... so on. The other method does not involve dividing or remainders. It just asks that you invert the old checksum register value, subtract the old data value bytes, add the new data value bytes, invert the number again, and write the LSB to the checksum register.
I would be attempting those later two methods, but as I said, my checksum register always reads as zero, unless I read it twice in a row (and by twice in a row I do not mean reading two databytes in the same I2C command, I mean performing an I2C write command on that same register as soon as the last one finished), in which case the second time I get 0xAC. To my understanding, I should be expecting something close to 0xE8, since that is what you should expect for -G1B.
Has anyone else run into this? I can confirm that I am not writing too fast or losing data because my loop reads the data and sends the data correctly hundreds of times according to my sniffer.
I can also confirm that my 0x06 flag is giving me 10011000, so I am in CFGUPMODE, the battery is detected, and OCVTAKEN is set.