I am using FreeRTOS on STM32F1. In an interrupt, I release a binary semaphore using xSemaphoreGiveFromISR, and tasks acquire the semaphore using xSemaphoreTake. The data processing in the task takes a long time, while the interrupt interval is short. As a result, the frequency of xSemaphoreGiveFromISR calls is higher than that of xSemaphoreTake. After running for some time, the xSemaphoreGiveFromISR in the interrupt can execute normally, but the task gets stuck at the xSemaphoreTake function and cannot acquire the semaphore. What could be the issue, and how can I resolve it?
Wrong interrupt priority/interrupt prio configuration ? This could cause the semaphore corruption you see.
See also RTOS for ARM Cortex-M
Also, ensure that you have defined configASSERT and enabled stack overflow checking.
I configured,but how to config configLIBRARY_LOWEST_INTERRUPT_PRIORITY and configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY, How should I fill in the values for these two?
Search the forum and you’ll find many relevant posts e.g. Couldn't run the scheduler after handling timer 5 Interrupt - #7 by hs2
and also this Understanding priority levels of ISR and FreeRTOS APIs - #16 by aggarg
or have a look at a matching FreeRTOS demo source in the
This page explains it in detail - RTOS for ARM Cortex-M
thanks,I have now reset the value of configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY, and so far, no issues have occurred.