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

TWI Clearing Bus with NRFX_TWI driver

Hello,

We are using the NRFX_TWI driver which we understand is a new and improved version of the legacy NRF_DRV_TWI driver.  However we are getting a number of apparent stuck-bus errors if our app breaks in the wrong place, and have to completely remove power from the system to get everything un-stuck (simply restarting the code does not help).

It appears this is a common problem and the solution given in https://devzone.nordicsemi.com/f/nordic-q-a/21508/twi-stuck-bus-recovery seems to be simple enough.  However I cannot find an analog for the NRFX_TWI driver, as this is not a valid parameter in the config_t struct:

static const nrfx_twi_config_t twi_config = {
.scl = TWI_SCL,
.sda = TWI_SDA,
.frequency = NRF_TWI_FREQ_400K,
//.clear_bus_init=true, //does not work
.interrupt_priority = TWI_DEFAULT_CONFIG_IRQ_PRIORITY};

Could you advise as to how to clear the bus?

Thanks!

--Allen

Related