freertos 8.0.1 failing to schedule any tasks after a sempahore take on Atmel SAMG55G19

My project runs in total 13 different threads and the task facing the issue is the one with highest priority. I am running a Freertos version 8.0.1 on Atmel SAMG55G19 microcontroller. There is a xSemaphoreTake on my button task (task with highest priority) with a blocking period of 2 seconds. Once in a while Freertos tends to not unblock, even after the expiry of 2 seconds, the semaphore take leading to a frozen thread. I have already investigated and confirmed that no other task is interfering with this task by faulty interrupts or lengthy critical sections. The issue is sporadic in nature and its frequency of occurrence is once or twice in a day. Looking forward to your suggestions. Thanks, Srinaag.

freertos 8.0.1 failing to schedule any tasks after a sempahore take on Atmel SAMG55G19

Hi Srinaag, The most likely cause is an incorrect interrupt priority assignment, even if you think it is correct. http://www.freertos.org/RTOS-Cortex-M3-M4.html The normal way of detecting this is to define configASSERT() (you will see a link to that on the page linked above), but you are using quite an old version of FreeRTOS and I’m not sure how many asserts it contains. I would recommend updating the FreeRTOS version to get better error detection. The second most likely cause is a stack overflow. http://www.freertos.org/Stacks-and-stack-overflow-checking.html Hope this helps.

freertos 8.0.1 failing to schedule any tasks after a sempahore take on Atmel SAMG55G19

Thank you for your suggestion, I will upgrade the Freertos and see if it helps fix things. Thanks, Srinaag.

freertos 8.0.1 failing to schedule any tasks after a sempahore take on Atmel SAMG55G19

Hi, I trying to porting freeRtos 7.3 to 9.0 for samG55 in my application. earlier i was using xTaskResumeFromISR() and vTaskSuspend() for task synchronize which was doing pretty well for my application but interrupt was less often. But later I found there are chances of missing, if interrupt rates are high and xSemaphoreGiveFromISR/xSemaphoreTake is solution for this. While porting i faced the same issue has above. the semaphore take thread being into block state. Looks this related to interrupt priority. I have macro in FreeRTOSConfig.h which i didnt understood. define configPRIO_BITS 2 configLIBRARYLOWESTINTERRUPTPRIORITY 0x0f configLIBRARYMAXSYSCALLINTERRUPT_PRIORITY 4 configKERNELINTERRUPTPRIORITY ( configLIBRARYLOWESTINTERRUPTPRIORITY << (8 – configPRIOBITS) ) configMAXSYSCALLINTERRUPTPRIORITY ( configLIBRARYMAXSYSCALLINTERRUPTPRIORITY << (8 – configPRIOBITS) ) Is this proper configured? i couldn’t able to find any information regarding “configPRIO_BITS” for armM4. Please do needfull Thanks, Seetharam

freertos 8.0.1 failing to schedule any tasks after a sempahore take on Atmel SAMG55G19

But later I found there are chances of missing, if interrupt rates are high and xSemaphoreGiveFromISR/xSemaphoreTake is solution for this.
If you are using FreeRTOS V9.0.0 then it is actually better to use task notifications as they are smaller and faster than semaphores. See the example on the following page: http://www.freertos.org/vTaskNotifyGiveFromISR.html
define configPRIO_BITS 2
I doubt that is correct as I’ve never seen a processor of this class only having 2 priority bits. Have a look in the hardware manual for the G55 part to find the number of priority bits that are actually implemented. It is likely to be between 3 and 5 inclusive.