I am trying to make TWI calls from an APP_TIMER event. However the TWI calls are failing. I can see that the twi message is sent on an oscilloscope, but the function never returns (handler function doesnt get called), and it holds the clock low after the last message.
I have tried increasing the TWI priority to highest (0) but no change. I am not running a soft device or any other timers.
Is there something prohibiting use of TWI functions from a timer callback function? Am I doing anything wrong, or is there a better way to go about this?
My main function is as follows, and does not work (twi as shown in image above):
If I modify it to call the twi_timer_handler function in the main loop, then it does work as expected.
Here is full code listing:
Many thanks!