Other Parts Discussed in Thread: BQ27426, EV2400, BQSTUDIO
I have copied the code from Appendix A of the SLUA801 "Gauge Communication" document. The host mCU is an ARM Cortex-M4 (nRF52832). In general the code appears to be working as expected up to the point of failure described next.
The actual point of failure is when the host attempts to set the checksum and receives a NAK. The transaction prior to this is the writing of the DC_STATE data via the gauge_write_data_class() function, which according to the included I2C trace shows as being successfully ACK-ed. There is a 10ms delay between these two I2C transactions, which I believe is sufficient for the BQ27426. I have increased the delay a bit, but to no effect: still getting a NAK on the writing of the checksum.
Also of noteworthy is the rather long clock-stretching for longer I2C transactions. While this is not wrong, it is an indication the BQ27426 is struggling to keep up with larger I2C writes.
I have attached a Logic Analyzer trace and a screenshot of the sequence in question.
Can someone help me understand what are the possible causes for this NAK?
TI_BQ27426_Programming_0426_2_02-bq27426G1gmfs_4Sep2019-3.logicdata.zip