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

Application firmware hangs up in twi_wait() function

Hello

I`m using the NORDIC nrf_drv_twi driver implementation from the PACK environment (version equivalent to SDK 8.1.0). Together with the S120 softdevice. If there is an active ble connection, somtimes the firmware hangs up in the twi_wait() function.

void twi_wait(void){
	do
	{
			__WFE();
	}while(m_xfer_done == false);}

Is there any known issue about priority problems or something like this, that could cause such a behaviour? The twi driver runs on APP_IRQ_PRIORITY_HIGH. If I set this priority to APP_IRQ_PRIORITY_LOW, the twi implementation completly wont work, if there is an active BLE connection. So I try to read out some data from the device via ble. This doesn`t even work, if the priority is set to LOW. If the priority is set to HIGH, it works, but sometimes the firmware hangs up in the twi_wait function. Any ideas?

Regards, BTprogrammer

Parents
  • I am just on ivestigating that problem. My idea why that happens is: If the priority of TWI is High, it has the same prio than the Sofdevice. Now, if the transfer rate on BLE is high, but the softdevice is "waiting" for the result from another characteristic call, it comes to some kind of a dead loop. Is that right!? But how to avoid this? I tried to add a twi_wait in the BLE on_write() function. But that doesn`t help. With that change, the firmware hangs up in this while loop (in the on_write function). Regards!

Reply
  • I am just on ivestigating that problem. My idea why that happens is: If the priority of TWI is High, it has the same prio than the Sofdevice. Now, if the transfer rate on BLE is high, but the softdevice is "waiting" for the result from another characteristic call, it comes to some kind of a dead loop. Is that right!? But how to avoid this? I tried to add a twi_wait in the BLE on_write() function. But that doesn`t help. With that change, the firmware hangs up in this while loop (in the on_write function). Regards!

Children
No Data
Related