Hi,
I am facing an issue with xSemaphoreGiveFromISR . It is not unblocking the task that is waiting on a xSemaphoreTake. I am working on ARM Cortex™-M3 core.
I use the xSemaphoreGiveFromISR in the ISR, and this interrupt is fired fast.
I have ensured that the interrupt is fired with an LED, as well as the call to xSemaphoreGiveFromISR is executed.
The firmware is blocked at this instance.
Please provide your inputs.
The priority of the interrupt is 7.
configMAX
SYSCALLINTERRUPT_PRIORITY is kept as 4.
gxSem_CntlessIntAvl is a binary semaphore.
The code is as below
ISR –>
void EXTI9
5IRQHandler (void)
{
#if (configUSE_TRACE_FACILITY == 1)
portENTER_CRITICAL(); // Required if nested ISRs are allowed
vTraceStoreISRBegin(ID_CLESS);
portEXIT_CRITICAL();
#endif
static portBASE_TYPE xTaskWoken = pdFALSE;
portBASE_TYPE xStatus = pdFALSE;
if(EXTI_GetFlagStatus(EXTI_Line5) == SET)
{
EXTI_ClearFlag(EXTI_Line5);
if (NULL != gxSem_CntlessIntAvl)
{
if (xQueueIsQueueFullFromISR(gxSem_CntlessIntAvl))
{
// Queue is full
}
else
{
xStatus = xSemaphoreGiveFromISR (gxSem_CntlessIntAvl,
&xTaskWoken );
if (xTaskWoken == pdTRUE)
{
//Force a context switch here not at all necessary
portYIELD_FROM_ISR (xTaskWoken );
}
}
}
}
#if (configUSE_TRACE_FACILITY == 1)
portENTER_CRITICAL(); // Required if nested ISRs are allowed
vTraceStoreISREnd();
portEXIT_CRITICAL();
#endif
}
TASK –>
….
while (TRUE)
{
if (pdFALSE == xSemaphoreTake (gxSem_CntlessIntAvl, gwStmTimeout/portTICK_RATE_MS))
{
PC_CL ('+');
byRetVal = ERROR_TIMEOUT;
break;
}
...
//Continue to process the interrupt.
}