cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f105: cannot wake up from Stop Mode if calling in Interrupt

Benjamin.Lee
Associate

Hey guys,

I've encountered a strange problem using stm32f105 Stop Mode. Simply put:

if PWR_EnterSTOPMode is called in the whie(1) main loop, then everything goes very well, both EXTI and RTC alarm can wake up MCU from Stop Mode.

However, if PWR_EnterSTOPMode is called in a interrupt handler function, like TIM2_IRQHandler, the MCU can go into Stop Mode but neither EXTI nor RTC can wake it up anymore.

I've tried to change the NVIC preemption priority of RTC, EXTI as well as TIMER, but this problem still exist.

Could anyone help me about this? Thanks.

1 REPLY 1
Mohamed Aymen HZAMI
ST Employee

Hello Benjamin,

To handle this error, you must set the exit EXTI priority (the EXTI that allow us to exit from STOP mode) higher than the entry EXTI (the EXTI that allow us to enter STOP mode).

example :

  /* EXTI interrupt init*/
  /* This EXTI to exit STOP mode */
  HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI0_IRQn);
	
  /* This EXTI to enter STOP mode */
  HAL_NVIC_SetPriority(EXTI1_IRQn, 3, 0);
  HAL_NVIC_EnableIRQ(EXTI1_IRQn);

Best Regards,

Mohamed Aymen.