STM32 wakeup from STOP2 mode using exernal interrupt(STMCUBE)

I am using freertos along with STMcube. configured tickless idle mode. I have a task that polls a GPIO (PA0) , and goes to stop2 mode using the API HALPWRExEnterSTOP2Mode(PWRSTOPENTRYWFI); When there is an interrupt on the same Pin (external interrupt wake u p pin), can I expect the system to wake up and resume all the tasks?

STM32 wakeup from STOP2 mode using exernal interrupt(STMCUBE)

That depends on what stop mode turns off – if it keeps the clock used by the tickless idle mode running, and keeps the RAM and register contents, then the answer is probably yes. There are many different variations of low power mode though so it is very specific to your chip and the low power mode chosen.

STM32 wakeup from STOP2 mode using exernal interrupt(STMCUBE)

STM32 Stop2 mode (at least on the procssors I have looked at) stops the processor clock, and many of the peripheral. Certain specified peripheral (most some Low Power peripheral) still run and can wake the system. I haven’t looked at this in detail, but likely will need to do this in the future, but I suspect that you will need some code to fully restore the system environment (the system wakes up in a reduced operating state as I remember), and after doing that you should be able to reenable interrupts and the system should resume. Since the system clock stopped, if you use the default systick driver, the system has no idea how long it was in the ‘Stop 2’ mode so be prepared for that. If you use a low power timer, running off a clock that is kept on during the Stop 2 Mode, you may be able to tell FreeRTOS how long it was asleep.

STM32 wakeup from STOP2 mode using exernal interrupt(STMCUBE)

Thank you Richard. I am thinking of calling the follwing after interrup wake up /* Reset of all peripherals, Initializes the Flash interface and the Systick. / HAL_Init(); / Configure the system clock / SystemClock_Config(); / Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART2_UART_Init(); MX_I2C2_Init(); MX_LPUART1_UART_Init(); MX_ADC1_Init(); /* Call init function for freertos objects (in freertos.c) */ MX_FREERTOS_Init(); /* Start scheduler */ osKernelStart(); or what is the best way to do this? these are beng called in the main. can I set my program conter to start from main (inside the ISR)?