I have a problem with my project when using a binary semaphore to wait for an isr.
The setup is that I have one active task (and idle at a lower priority) and I call xSemaphoreTake.
When I call this, the cpu hangs in vListInsert trying to insert the task into the semaphore pending list. This is because the task is already in this list.
A little bit of tracing shows:
- call xSemaphoreTake
- insert task into semaphore
- remove task from ready
- call xTaskResumeAll (returns false)
- insert task into semaphore
The resumeAll is trying to switch to another task, but there are no others but this one at this priority. Then xQueueSemaphoreTake goes around the for loop again, and re-inserts the task into the queue.
Is there something I have misconfigured here? This all works fine if there is another task to take up the yield, but in some cases there will not be.
Specifics: FreeRTOS 10.3.1 STM32 cortex-M4 gcc