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

TWI timeout - SDK11

Hi,

I'm using the nrf_drv_twi driver (master) to communicate with a number of IO components, such as LEDs, buttons etc.

If my IO component does not respond (why is not relevant to this question, but it does...), the code hangs (nrf_drv_twi.c, line 450)

while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t *)p_data, length, no_stop))
        {}

How would one add a timeout?

  • Modifyexisting code?
  • Use the driver in non-blocking mode?
  • Wait for Nordic to add this feature?

Thank you Matthias

Related