This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

aborting nrf_twi_mngr_perform

It seems like there is the possibility of an infinite loop in the function nrf_twi_mngr_perform() near line 361 where it calls the user function. If the I2C bus is messed up somewhow (e.g. TWI module is in suspend), we may never exit. If it's true that we could get stuck there forever, I would like to implement my user function to reset the TWI module while aborting the current transaction.

First of all - am I correct that I may get stuck in this loop forever? Or is this prevented by safeties in the driver or TWI module itself. Assuming that I should be prepared to handle it myself...

What is the best way to do this? Right now (if I time out,) I call nrf_twi_mngr_uninit() then nrf_twi_mngr_init(). Will this reset the hardware TWI module as well as the transaction manager? Or should I assert the TWI modules RESUME and/or STOP tasks, perhaps using the nrf_drv_twi driver? Sorry I can't just test it myself because it's a hard condition to create. I did see it stuck in suspend once, though. FYI - I'm talking to a LSM6DSMTR IMU.

I'm working on a custom board based on the nRF52832. I'm developing on Win 8.1 using SES and a J-Link Plus. SDK version 14.1.

Related