freeRTOS xTaskResumeAll lockup when using BLE and TWI

Hi…

I am using freeRTOS V10.0.0 release

I am using nRF52820 + SDK V17.0.2 with SD112 V7.2.0 along with tickless idle as this is a battery based product…

When my application is just talking over the IIC bus it works perfectly   ISR Priority = 3
When my application is just talking over BLE it work perfectly               ISR Priority = 3

When I talk over IIC bus and BLE at the same time, somethings gets stuck and the watchdog resets to product… Not a great user experience !!

Here is my investigation
When the firmware freezes, I then paused the CPU…
I see that the CPU is stuck in the freeRTOS tasks.c API xTaskResumeAll() in an endless loop inside while( listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE )

When I single step the CPU, the while loop keeps on going around and around
xPendingReadyList.uxNumberOfItems remains at 1, so pdFALSE condition never happens 

I have looked here: endless loop in function xTaskResumeAll which talks about interrupt priorities clashing…  I have made all ISRs that I use to Priority = 3 except for RTC1 => 7 (see attached picture), as this problem could be due to corruption of the freeRTOS structures due to different ISR priorities 

What I have done to fix the problem
I added a counter in the while loop that will exit after counter reaches # of tasks created
This works well and my application now works perfectly when IIC and BLE activity happen at the same time

uint8_t retry = 0;
while( (listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE) && (retry < uxCurrentNumberOfTasks) ) {
   …
   retry++;
}

Thanks for any Help
Ray

Parents Reply Children
No Data
Related