Hi,
I want to read onboard sensor data from B-L475E-IOTA1 using I2C2. When I use the MBED API i2c_api.c (’ i2c_write() to write the memory address and i2c_read() to read the value in that address’) , I am able to read the data correctly but randomly in between I receive a NACK due to ARLO i2c interrupt error in i2c_write() leading to status as Not Acknowledged. Then, automatically it comes out of that error in subsequent cycles without even re-initializing the I2C bus. No such error is seen when I try to read external sensors using I2C1 AND I2C3 .
When I tried to use blocking mode HAL_I2C_Master_Transmit() and HAL_I2C_Master_Receive() instead of the non-blocking IT based Transmit and Receive in MBED APIs , similar error is observed with timeout happening while waiting for TXIS flag leading to status as NACK. It then receives ACK in subsequent cycles without even reinitializing the bus.
No such random NACK is observed when I use HAL_I2C_MEM_READ as given in the MBED example to read onboard sensor data for the board.
Please let me know that why such behavior is observed and what is the solution.
Any solution/alternative would be appreciated.
Thank you