Hi,
I am using a nRF52832 to communicate with a ICM-20948. I've been trying to write a 16 byte packet of data and read back and verify that same data. According to the ICM-20948 datasheet, the write and read sequences for multiple bytes needs to be as follows. This seems to work just fine when I use an oscilloscope to monitor the data written. All of the ACK conditions and the stop condition are returned by the ICM-20948 for each of the 16 bytes of data.
For a single byte read (i.e. WhoAmI register) the write then read sequence completes just fine with all ACKs and NACKs (and I read back the expected register data 0xEA)
For multiple byte reads however, when using the following setup and implementation of TWI shown in the code below, I am able to complete the first start condition through the last ACK just fine. The point where I get an error is when I send the Slave I2C address and read condition (AD+R) I should get an ACK back from the device. However, this first ACK in the read sequence isn't returned. Each subsequent ACK after each byte of data is received just fine and the data is NACK'ed at the end. Is there something in my TWI setup that would disallow the device to have enough time or be able to send that first ACK correctly?
TWI Initialization:
readByte and readBytes method:
Method to call readBytes, etc: