cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 not going to sleep on __WFE()

mandrake
Senior
Posted on March 11, 2015 at 18:12

I am running STM32F407 with IAR EW toolset and trying to put the CPU into sleep mode.

The processor never stops at __WFE( ).

Any idea what I am doing wrong?
4 REPLIES 4
Posted on March 11, 2015 at 18:37

Any idea what I am doing wrong?

No, are you observing from a debugger?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
mandrake
Senior
Posted on March 11, 2015 at 19:02

I just read your comment about the STM32F407 errata.

I just read the errata. I examined DBGMCU_CR and all bits are zero.

Still no sleep mode with ST-LINK disconnected. It is either it never goes to sleep or something is waking up the CPU.

mandrake
Senior
Posted on March 11, 2015 at 20:25

It appears I made a mistake somewhere.

When I remove the debugger it appears to work properly.

mandrake
Senior
Posted on March 14, 2015 at 15:07

I have two STM32F407 MCU running identical code. They go to sleep when I stop using the debugger.

I need each CPU to go to sleep one time on power-up. An external event on a GPIO pin wakes the CPU.

One MCU works perfectly everytime. The second one goes to sleep intermittently.

I found that both chips will wake up with USART interrupt. That surprised me because I thought that it would wake up from WFE only on an event and not interrupts.

It appears that the misbehaving CPU is experiencing some interrupts or events that I am not aware of. I have disabled all activity and enabled only one GPIO (PB15) input for event mode.

Still stumped!