Deferred interrupt using xTaskNotifyIndexedFromISR NOT WORKING

on the below code using Deferred interrupt method even though interrupt is coming and calling the EXTI2_IRQHandler, prvReceivePacket (NULL, 0) function is not called.

#define ULONG_MAX 0xffffffff

/* Repetitive task. */
void vHandlingTask( void * pvParameters )
{


      uint32_t ulInterruptStatus=0;

      for( ;; )
      {
          /* Block indefinitely (without a timeout, so no need to check the function's
          return value) to wait for a notification.  NOTE!  Real applications
          should not block indefinitely, but instead time out occasionally in order
          to handle error conditions that may prevent the interrupt from sending
          any more notifications. */
          xTaskNotifyWaitIndexed( 0,                  /* Wait for 0th Notificaition */
                                  0x00,               /* Don't clear any bits on entry. */
                                  ULONG_MAX,          /* Clear all bits on exit. */
                                  &ulInterruptStatus, /* Receives the notification value. */
                                  portMAX_DELAY );    /* Block indefinitely. */

          /* Process any bits set in the received notification value.  This assumes
          the peripheral sets bit 1 for an Rx interrupt, bit 2 for a Tx interrupt,
          and bit 3 for a buffer overrun interrupt. */
              prvReceivePacket (NULL, 0);
      }


}

/*  ISR */
void EXTI2_IRQHandler( void )
{
  BaseType_t xHigherPriorityTaskWoken = pdFALSE;



  xTaskNotifyIndexedFromISR( vHandlingTask,
                              0,
                              1,
                              eSetBits,
                              &xHigherPriorityTaskWoken );

      /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
      should be performed to ensure the interrupt returns directly to the highest
      priority task.  The macro used for this purpose is dependent on the port in
      use and may be called portEND_SWITCHING_ISR(). */
      portYIELD_FROM_ISR( xHigherPriorityTaskWoken );

}





below one is task creating codes




if (xTaskCreate( vHandlingTask, "Reg2", 300, NULL, 1, NULL )){
}
if (xTaskCreate( prvRegTestTaskEntry3, "Reg3", 300, NULL, 2, NULL )){
				vSendString("Task 3 Created \n\r");
}

/* Start the scheduler. */

vTaskStartScheduler();

The task handle returned by xTaskCreate (the TaskHandle_t *pxCreatedTask argument) is required for xTaskNotifyIndexedFromISR and not the function pointer of the task function as documented here xTaskNotifyFromISR() Real Time Operating System API documentation.
I wonder if there were compiler warnings regarding the wrong argument…

1 Like

Thanks for your reply and addressing the issue…