cancel
Showing results for 
Search instead for 
Did you mean: 

STOP Mode on STM32L152

aa_talaat
Associate II
Posted on September 07, 2013 at 11:46

Hello,

I am using the STM32L152 Discovery board. My program is structured as main where needed initialization and configurations are performed then a while loop is entered with a big switch statement that takes different actions based on type of interrupt received.

In the stm32l1xx_it.c file, the interrupt handler for each relevant interrupt is clearing its corresponding flag, and setting a shared flag to indicate the type of interrupt received to be handled in the main program loop.

The interrupts I am dealing with are:

  • EXTI from the only push button available on PA.01,
  • RTC in wakeup mode each second,
  • TIM2 configured in OC mode with CCR1 and CCR2 to generate two different periodic interrupts.
When there is no interrupts to handle, then I should put the CPU in STOP mode to save power. So, in the default of the interrupt switch of the main loop, I use the following two commands:

PWR_UltraLowPowerCmd(ENABLE);      PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

I have the following questions:

  • Is the logic of stop mode is that the program stops when it is invoked, and resumes when an interrupt is received by performing the interrupt handler then resuming program execution just after the STOP command?
  • I read in the reference manual that after coming out of the STOP mode, I should reconfigure my clocks as I am using the HSI and not the MSI (which is the default after waking up). Is this the only thing I should worry about to restore after resuming from STOP mode?
  • I read in several places, but still not clear to me what is the difference between WFI and WFE, and when should each of them be used?
Thank you.

#discovery #stop-mode #stm32l
0 REPLIES 0