Tickless context switch before going to sleep EM2

I am new on FreeRTOS and I cannot figure what is my mistake.
I am working on a EFM32TG11B (ARM M0+) with FreeRTOS V10.1.1 The project use the tickless mode of freertos.
My problem is the following.
I enter an interrupt, in this interrupt I send a signal to a task

BaseType_t xHigherPriorityTaskWoken = pdFALSE;
(void) xTaskNotifyFromISR(g_ISSITcb,ulValue,eSetBits,&xHigherPriorityTaskWoken);
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );

The task is waiting for the signal

(void) xTaskNotifyWait(0x00,ULONG_MAX,ulNotifiedValue,portMAX_DELAY);

So when I exit the interrupt, I expect the OS to go and execute the task. But it seems it go directly to the task IDLE and my task is in READY state.

Moreover, in the void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
I go in EM2 like bellow :


Important informations, if I pause and re run the debugger, it is working, I go into the task.
If I comment the EMU_EnterEM2(true), it is also working.

Do you have any idea what could be the problem ?
Thank you very much

Did you add this code? I don’t think it’s right. In Cortex-M, you should actually go to sleep with interrupts disabled. Otherwise the CPU might handle the interrupt that is supposed to wake you up and then go to sleep. You don’t want that.

Concur - looks like the enabling and disabling of interrupts are the wrong way around.

Hello, true I did a mistake here. So now my I2C is working well but vTaskDelay from the RTOS are now stucked and never end. Do you have an idea or work around ?

If you have modified vPortSuppressTicksAndSleep(), you may have other errors there. Try going back to the “official” version of port.c and see if the problems go away. By the same token, if you have defined configPRE_SLEEP_PROCESSING and/or configPOST_SLEEP_PROCESSING, eliminate those too.