2009-02-10 04:18 PM
problems of lowpoer mode
2011-05-17 04:02 AM
Hi,I'm using STM32F103VB-LK eval board.
I'm do lowpower test with stop mode.before entering stop mode ,I used HSE as system clock. Q1:What's the state of MCU after waking up?Is the state Reset mode or else?And I wanted to use serial IT to wake up the core but failed.(serial port and EXT IT has been INIT already) Q2:When MCU in STOP mode,can the core be waked up by RTC alarm clock? Thanks!2011-05-17 04:02 AM
Hi venus,
When exiting from STOP mode, the HSI RC oscillator is selected as system clock and the SRAM and register contents are preserved. So, after wakeup from Stop mode, you need to re-configure the system clock based on the HSE, PLL… For sure you can wakeup your system from stop mode via the RTC alarm. I would suggest you to refer to either STOP mode example provided in thehttp://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Firmware
or tohttp://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Application Note
for guidelines to low power modes configuration. Cheers ;)2011-05-17 04:02 AM
HI coucou,
thanks for your reply,I have read your tip.The core can enter STOP_LowPower mode.And I chose HSI as system clock.I used RTC alarm to wake up the core but still failed(EXT line 17 has been INIT and conneced).Step by step,the code died in RTC,LSE can not be selected. Here is what I tried getting stop mode working: First IT setup. NVIC CONFIGS: /* Enable the EXTI17/Alarm Channel Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; NVIC_Init(&NVIC_InitStructure); /* Configure EXTI Lines with rising edge detect */ EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_Line = EXTI_Line17; //RTC_Alarm EXTI_Init(&EXTI_InitStructure); The Interrupt ''void RTCAlarm_IRQHandler(void)'' needs if(RTC_GetITStatus(RTC_IT_ALR) != RESET){ RTC_WaitForLastTask(); RTC_ClearFlag(RTC_FLAG_ALR); RTC_WaitForLastTask(); .... } EXTI_ClearITPendingBit(EXTI_Line17); ENTRY: PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI); CODE TO SET ALARM: //This assumes that your RTC is already setup to Tick at 1 sec RTC_WaitForLastTask(); /* Wait until last write operation on RTC */ RTC_SetAlarm(RTC_GetCounter()+2); //Wakeup in 2 seconds RTC_WaitForLastTask(); /* Wait until last write operation on RTC */ RTC_ClearFlag(RTC_FLAG_ALR); RTC_WaitForLastTask(); /* Wait until last write operation on RTC */ RTC_ITConfig(RTC_IT_ALR,ENABLE); RTC_WaitForLastTask(); /* Wait until last write operation on RTC */ I put RTC alarm code ahead of ''PWR_EnterSTOPMode()'',the core can not be waked up.I tried this for weeks but still failed :-[ .Wait for your reply. VenusQuote:
On 09-02-2009 at 19:42, Anonymous wrote: Hi venus, When exiting from STOP mode, the HSI RC oscillator is selected as system clock and the SRAM and register contents are preserved. So, after wakeup from Stop mode, you need to re-configure the system clock based on the HSE, PLL… For sure you can wakeup your system from stop mode via the RTC alarm. I would suggest you to refer to either STOP mode example provided in thehttp://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Firmware
or tohttp://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=110#Application Note
for guidelines to low power modes configuration. Cheers ;)2011-05-17 04:02 AM
Hi venus,
I'm attaching an example of STOP mode configuration I had used on my evaluation board. System wake up from stop mode via RTC alarm. That may helps you ;) [ This message was edited by: coucou on 10-02-2009 23:57 ]2011-05-17 04:02 AM
Hi coucou,
Thanks for your code,I have solved my problem.However,about waking up from STOP mode,the manual(RM0008,page52) said: ''When exiting Stop mode by issuing an interrupt or a wakeup event, the HSI RC oscillator is selected as system clock''.Did the HSI need to be initialized? Venus