Skip to main content
mandrake
Associate III
March 11, 2015
Question

STM32F407 not going to sleep on __WFE()

  • March 11, 2015
  • 4 replies
  • 905 views
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?
    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    March 11, 2015
    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    mandrake
    mandrakeAuthor
    Associate III
    March 11, 2015
    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
    mandrakeAuthor
    Associate III
    March 11, 2015
    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
    mandrakeAuthor
    Associate III
    March 14, 2015
    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!