cancel
Showing results for 
Search instead for 
Did you mean: 

Exit from STOP mode

con3
Senior

Hi everyone,

I'm slightly confused here.

I'm putting my micro into stop mode, but I can't seem to wake it up using an interrupt.

Here's how I'm setting it:

__HAL_RCC_GPIOA_CLK_ENABLE();
	GPIO_InitTypeDef GPIO_InitStruct;
	GPIO_InitStruct.Pin = GPIO_PIN_4;
	GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
	HAL_NVIC_ClearPendingIRQ(EXTI4_IRQn);
	HAL_NVIC_SetPriority(EXTI4_IRQn, 0, 1);
	HAL_NVIC_ClearPendingIRQ(EXTI4_IRQn);
	HAL_NVIC_EnableIRQ(EXTI4_IRQn);
 
	HAL_SuspendTick();
	//Enter STOP mode (deepsleep) and set the exit condition as wait-for-interrupt
	HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
	// HSI clock is selected after wakeup from deepsleep, reset clock to HSE and reset clock tree.
	SystemClock_Config();
	HAL_ResumeTick();

Prior to entering stop mode, I set the pin that I want to trigger the interrupt on. then I suspend the systick and enter the stop mode with WFI activated.

After this, if I trigger GPIOA - PIN4, nothing happens. If I don't enter stop mode, then the interrupt operates normaly, that is it'll enter the interrupt handler. After exiting stop mode, I reset the clock tree using systemclock_config. But at this point, I can't seem to exit stop mode.

Does anyone know what I could be doing wrong ?

Thanks in advance for any help

3 REPLIES 3
Rob.Riggs
Senior III

Which STM32 MCU are you using?

It's an stm32f722ze

Mohamed Aymen HZAMI
ST Employee

Hello,

Do you have the same problem in sleep mode ?

Do you have other wake up source enabled ?

note that you must clear all the pending wake up sources to make sure that the CPU wake up from your interrupt.

Regards,

Mohamed Aymen.