cancel
Showing results for 
Search instead for 
Did you mean: 

Stop mode and clock configuration at wake up

Aurélien f
Senior
Posted on December 28, 2017 at 07:42

Hello,

I'm facing an issue i cannot figure out. I'm currently working on a stm32l073 and using the following RTOS : RIOT-OS. When i wake up from stop mode, UART seems to be desynchronized because wrong characters are displayed. 

I have noticed that when i'm decreasing system clock, AHB clock and ABP clock all is working fine. Am i doing something wrong or do i need to reconfigure clock in the interrupt that is waking up the CPU from stop mode (this a RTC interrupt) ? 

If you have any ideas about this issue, feel free to share your thoughts

Best regards,

Aur�lien

#stm32 #stop-mode #stm32l073
13 REPLIES 13
Enrico Poli
ST Employee
Posted on January 04, 2018 at 14:02

I think this is a question for the

https://community.st.com/community/stm32-community/stm32-forum

buff thokoa
Associate III
Posted on May 02, 2018 at 19:27

Hi 

Aurélien,

I am also experiencing the same thing...

Did you ever have any luck with a solution??

Posted on May 02, 2018 at 21:35

Hi,

Now, just after the wake up, i reconfigure the clock. Actually, this is done by the RTOS. I'm using RIOT-OS which is quite new but well done. 

Regards,

Aurélien

Posted on May 02, 2018 at 21:43

Hi,

I have not been as lucky as you I'm afraid.

I'm using MXCUBE and FREERTOS. The steps I am following are:

Before STOP Mode I do some hardware configuration, deinit the UART and start the RTC wake up on interrupt.

When that is done I reinit the UART. I am expecting to see a message OK come back from the UART but nothing happens.

Posted on May 02, 2018 at 22:15

i'm not sure you need to deinit and then reinit the UART driver, but just after wake up (after wfe or wfi instruction), try to reinit the entire clock tree by calling systemClockInit or something like that

Posted on May 03, 2018 at 09:35

I have seen the deinit and init on numerous posts...

Should the code stop running completely when it hits the STOP function and only continue after?

My code is below. The SystemClockConfig_STOP function reconfigures the clock tree. I am using an RTC wakeup interrupt. 

HAL_SuspendTick();

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

HAL_ResumeTick();

SystemClockConfig_STOP();
Posted on May 04, 2018 at 11:51

Hi,

Where are you trying to print. Is it in your RTC interrupt ?

Posted on May 04, 2018 at 12:45

Try to call

SystemInit();

directly after wake up.

Posted on May 04, 2018 at 14:11

I'm suspecting you are trying to print before the clock a reinitialized. Indeed, your interrupt triggers before you main code continues running after the stop instruction !