AnsweredAssumed Answered

FreeRTOS xSemaphoreTakeFromISR() not blocking

Question asked by Momir Partalo on Jun 21, 2016
Latest reply on Jun 22, 2016 by Erich Styger

I am using FreeRTOS from the Kinetis SDK 1.3.0. A snippet of my code is provided below. Why is the second call to xSemaphoreTakeFromISR()  not blocking and not waiting for xSemaphoreGiveFromISR() to release the binary semaphore? If I disable xSemaphoreGiveFromISR() from within IRQHandler_A(), my code within IRQHandler_B() will still move to the next instruction.

 

void IRQHandler_A(void)

{

…..

xSemaphoreGiveFromISR(Sem, NULL);  

…..

}

 

void IRQHandler_B(void)

{

static bool once = true;

                if(once)

                {

                               xSemaphoreTakeFromISR(Sem, NULL);  // first time

                               once = false;

                }

…..

xSemaphoreTakeFromISR(Sem, NULL);

// next instruction

…..

}

Outcomes