cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F070 Standby Mode (Not waking up...)

andreas kellermann
Associate II

I wanted to test the wakup pin on the stm32f070f6.

I have set pin PA0 to SYS_WAKUP1 and gave it the user name "WAKE".

Before the user while loop I call:

 HAL_PWR_EnableWakeUpPin(WAKE_Pin);

 HAL_PWR_EnterSTANDBYMode();

To enable wakeup (I thought) and put the device into standby.

The device goes into standby, but does not wake when I apply 3.3V to PA0 (?)

Are there more settings/setup? Is there more documentation then just the HAL manual?

Thank you in advance!

6 REPLIES 6
turboscrew
Senior III

Nice. I wrote some stuff, and suddenly the page got refreshed or something, and all I wrote was gone...

So again. See https://www.st.com/content/ccc/resource/technical/document/reference_manual/cf/10/a8/c4/29/fb/4c/42/DM00091010.pdf/files/DM00091010.pdf/jcr:content/translations/en.DM00091010.pdf

Chapter 6.3

Also clear the wakeup-related flags in the PWR .

I also recall that if WKUP-pin is high during setup, no rising edge is detected, and the device won't wake up.

andreas kellermann
Associate II

Interesting. I found the:  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU) function to clear the Wakup flag.

I also added a pull down resistor on PA0. Now it should start up low.

Relevant code now looks like this:

 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); //clear wakup flag

 __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); //clear standby flag

 HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

 HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2);d

 HAL_PWR_EnableWakeUpPin(WAKE_Pin);

 HAL_PWR_EnterSTANDBYMode();

However, no change...

I also had a look at the HAL function to enter standby mode:

void HAL_PWR_EnterSTANDBYMode(void)

{

 /* Select STANDBY mode */

 PWR->CR |= (uint32_t)PWR_CR_PDDS;

 /* Set SLEEPDEEP bit of Cortex System Control Register */

 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

 /* This option is used to ensure that store operations are completed */

#if defined ( __CC_ARM)

 __force_stores();

#endif

 /* Request Wait For Interrupt */

 __WFI();

}

Looks pretty much as described in chapter 6.3 table 19.

turboscrew
Senior III

You know that it doesn't wake up? I mean, maybe it hangs somewhere during boot?

I once had waleup problems with L4 device when there was an oscillator shared with another chip. - the oscillator was reluctant to start,

but I don't think this case is similar. Even then it woke up, but getting from RC to xtal hung up.

Usually waking up is easy, but getting the darn thing to sleep may get complicated. 😉

If you try to debug, you need to set DBG_STANDBY-bit in DBGMCU_CR-register.

andreas kellermann
Associate II

Well if I disable the standby function by commenting out

//HAL_PWR_EnterSTANDBYMode();

The program runs normally. So it looks to me as if it enters standby and never wakes up.

turboscrew
Senior III

That commenting doesn't really prove anything. Remember that stand-by "almost-resets" l the HW - including HSE - and RAM.

Maybe the HW is left in some state that wake-up doesn't handle well.

My problem back then was, that HSE-ready-flag got never set.

Piranha
Chief II

https://community.st.com/s/question/0D53W00001bnh8dSAA/how-to-enter-standby-or-shutdown-mode-on-stm32

The particular issue of the original topic is most likely the issue 1 in my article.