Question
STM32L151 Stop mode problem
Posted on October 14, 2014 at 11:13
Hi all!
I faced problem with STM32L151 and i hope to find some useful considerations. The problem is following. I use stop mode with RTC. RTC is configured with periodic wake-up timer. I also use external line to wake up from Stop mode. The controller goes to Stop mode and wakes up coorectly by timer or by external line. After that I config sys clock and do some actions with periferals. After everything is done, I set it to Stop mode again and the debug session fails. It looks like the core doesn't have any supply at all. The controller fails after __WFI(); then i usePWR_EnterSTOPMode
second time. I tried to disable debug and to disconnect ST-Link, but the result is the same.int main()
{
DBGMCU_Config(DBGMCU_SLEEP | DBGMCU_STANDBY | DBGMCU_STOP, ENABLE); //Enable debug in powersafe modes
Init_Active(); //Init active mode clocks & perif
General_GPIO_Init(); //Init GPIOs
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
Init_Active(); //Init active mode clocks & perif
//do some actions
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); // here program fails
}
void RTC_WKUP_IRQHandler(void)
{
if(RTC_GetITStatus(RTC_IT_WUT) != RESET)
{
RTC_ClearITPendingBit(RTC_IT_WUT);
EXTI_ClearITPendingBit(EXTI_Line20);
if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)
{
PWR_ClearFlag(PWR_FLAG_WU);
}
Program_Stat = RTC_WK_UP;
}
}
void EXTI3_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line3) != RESET)
{
EXTI_ClearITPendingBit(EXTI_Line3);
Program_Stat = ACTIVE;
}
}