Hello Team,
I am seeing an issue when I use Free RTOS API inside USART interrupt handler.
I am suspecting the issue could be with setting priority, even though I set the value correctly, but not sure why interrupt handler called once and not getting invoked 2nd time onwards.
Let me provide few details about priority,
#define configPRIO_BITS 3
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
So configMAX_SYSCALL_INTERRUPT_PRIORITY value is 64 (0x40) => That corresponds to logical priority level 2
I am using LPC55s69, and it uses 3 bits for priority level.
Valid priority values in hardware: 0x00, 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0
I set the interrupt priority value to 3 → NVIC_SetPriority(USART2, 3);
In the interrupt handler, I am using rtos API like this,
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR(rcvsemaphore, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
in the task handler there is a wait call,
if(xSemaphoreTake(rcvsemaphore, portMAX_DELAY) == pdTRUE)
The task creation is like this,
xTaskCreate(ComRcvTask, (const char*) “ComRcv”, 1024, NULL, 4, NULL);
I am using FreeRTOS Kernel V10.5.1, I know there is a new version, but I am yet to migrate.
Observation:
- When the data arrives at USART RX, in the interrupt handler it is stored in a local buffer and notified to the task handler for further processing.
Issue:
In the 2nd iteration, when the data arrives the control never reaches interrupt handler?
Even I debugged the code, but I am not seeing anything in the stack (I can only see Thread 1 running)
Can someone please let me know, what is missing?
Regards,
San