FreeRTOS version: 8.0.1 (most recent version available in Atmel Studio 7)
I’m trying to defer function processing by calling xTimerPendFunctionCallFromISR() in a USB handler ISR.
I followed the example from http://www.freertos.org/xTimerPendFunctionCallFromISR.html and have something like the following in my function UHP_Handler():
... BaseType_t xHigherPriorityTaskWoken = pdFALSE; xTimerPendFunctionCallFromISR(ohci_bottomhalf, &IntInfo, NULL, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); ...
When the timer task runs, it gets blocked on portYIELD_WITHIN_API() when there are no messages in the queue and then it never seems to unblock even after messages get queued.
I have the task priorities set up such that the timer task priority has highest priority (largest numeric value) and have the USB interrupt priority set up as 11 (which is lower priority than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY) .
Other relevant code :
#define configMAX_PRIORITIES ( ( uint32_t ) 5 ) #define configPRIO_BITS 4 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 10 #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
I have three tasks running: idle task (priority 0), timer task (priority 4), and an application task (priority 1).
Why isn’t the timer task running after portYIELD_FROM_ISR() gets called in the interrupt handler? The first time that the interrupt handler executes, xHigherPriorityTaskWoken does get set to pdTRUE, but in every subsequent execution, this variable equals pdFALSE.