I asked the following question, TWI Stuck Bus Recovery, last week and got a great answer which I implemented. I tested my implementation by changing the device addresses to see if my system could detect the problem, report it and continue to try and clear the problem. This is all working well.
In order to test physical bus issues I tired grounding the SDA line to see how my implementation would handle this and I was surprised to find my system was stuck in a infinite loop in app_twi.c executing
while (p_app_twi->internal_transaction_in_progress)
{
if (user_function)
{
user_function();
}
}
What's the best way to implement a timeout or stop this from occurring. I realize that a I2C bus that has SDA grounded isn't likely to occur but our device has a long operating life target and I am trying to be thorough.
Thanks, Darren