taskYIELD() causes hang inPIC24f interupt

Per the FreeRTOS documentation to handle API calls inside of an interrupt I need to taskYIELD if necessary, I have the following ISR: void __attribute__ ((__interrupt__, no_auto_psv)) _T4Interrupt(void)
{
   portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
   IFS1bits.T4IF = 0;
  
   xQueueSendToBackFromISR(queue_name, &queue_data, &xHigherPriorityTaskWoken);    if(xHigherPriorityTaskWoken == pdTRUE)
   {
       taskYIELD(); // Force context switch
   } Everytime xHigherPriorityTaskWoken is true and the taskYIELD() executes, my processor resets.  I’ve debugged to determine this is correct.  If I comment out the taskYIELD, everything works smoothly. The only thing I can think is that the priority of this interrupt is 7 and the tick timer has priority 1, but I’m not disabling any interrupts and per the RTOS docs this should be the correct method to use.

taskYIELD() causes hang inPIC24f interupt

The correct function to use to switch tasks inside an interrupt is vTaskSwitchContext, not taskYield.  So your code should look like this:    if(xHigherPriorityTaskWoken == pdTRUE)
   {
       vTaskSwitchContext(); // Force context switch
   }

taskYIELD() causes hang inPIC24f interupt

I think in this case calling taskYIELD() is the correct thing to do – but this must be done as the very last thing in the ISR routine.  Is it the last line of executable code? FreeRTOSDemoPIC24_MPLABserialserial.c has an example ISR. Regards.

taskYIELD() causes hang inPIC24f interupt

I’ve solved the problem.  It turns out I was getting a stack overflow on my IDLE task.  I had been assuming that the stack used for interrupts was from the task executing when the interrupt occurred which wouldn’t have caused any stack issues. Could someone shed some light on what consumes the IDLE task’s stack during operation?  (I have no user defined IDLE hook or anything that should be used during idle time). (It looks like taskYIELD() is correct, when I switched it out with vTaskSwitchContext() I got strange behavior)