<div dir="ltr">do have service 
routine,  handler can printk log,  SLEEPONEXIT is 0<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 20, 2019 at 5:19 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de">list@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 20/06/2019 10:57, Jython wrote:<br>
> a GPIO EXTI line,<br>
> rtems idle phrase called __wfi, does it make stm32 enter standby mode?<br>
> so key can not wake up it from sleep function<br>
<br>
Please take a look at the reference manual of your chip. Most likely<br>
it's "RM0090 Rev 18" but make sure that's the right part number:<br>
<br>
    <a href="https://www.st.com/resource/en/reference_manual/dm00031020.pdf" rel="noreferrer" target="_blank">https://www.st.com/resource/en/reference_manual/dm00031020.pdf</a><br>
<br>
On page 127 there is a description of "Entering low-power mode":<br>
<br>
    "Low-power modes are entered by the MCU by executing the WFI (Wait<br>
    For Interrupt), or WFE (Wait for Event) instructions, or when the<br>
    SLEEPONEXIT bit in the Cortex ®-M4 with FPU System Control<br>
    register is set on Return from ISR."<br>
<br>
There is also a description for "Exiting low-power mode". For WFI "any<br>
peripheral interrupt acknowledged by the NVIC can wake up the device."<br>
So your interrupt has to be set up.<br>
<br>
Your code seems to enable the interrupt. But have you registered a<br>
interrupt service routine? Otherwise you might get problems with an<br>
unhandled interrupt on wakeup.<br>
<br>
I only skimmed through the power controller chapter. But it seems that<br>
if you have SLEEPDEEP bit set, you will enter a deeper sleep mode<br>
where peripheral clocks can be disabled. In that state it's possible<br>
that only special pins (like the WKUP) can wake up the processor<br>
again. Please have a detailed look at that chapter to find out all<br>
traps.<br>
<br>
Best regards<br>
<br>
Christian<br>
<br>
> <br>
> <br>
>     void keys_init()<br>
>     {<br>
>         // config gpio<br>
>     stm32f4_gpio_set_config(&io_key1);  // PA12<br>
>     stm32f4_gpio_set_config(&io_key2);<br>
>         stm32f4_gpio_set_config(&io_key3);<br>
>     stm32f4_gpio_set_config(&io_key4);<br>
> <br>
>        <br>
>         //  SYSCFGEN and exit map<br>
>     (*(uint32_t*)0x40023844) |= 1<<14;<br>
>        <br>
>         SYSCFG_EXTICR3 = 0;<br>
>         SYSCFG_EXTICR4 = 0;<br>
>        <br>
> <br>
> <br>
>         // EXIT INIT<br>
>     EXTI_IMR |= (1<<12);<br>
>     EXTI_RTSR |= (1<<12);<br>
> <br>
>         EXTI_IMR |= (1<<11);<br>
>     EXTI_RTSR |= (1<<11);<br>
> <br>
>         EXTI_IMR |= (1<<10);<br>
>     EXTI_RTSR |= (1<<10);<br>
> <br>
>         EXTI_IMR |= (1<<9);<br>
>     EXTI_RTSR |= (1<<9);<br>
> <br>
> <br>
>         //NVIC_Init<br>
>         //NVIC it group2<br>
> <br>
>     SCB_AIRCR = 0x05FA0000 | 0x500;<br>
>     // ip Interrupt priority register x<br>
> <br>
>     //(*(volatile uint8_t*)0xE000E417) = 0xe0;  //23<br>
>         //(*(volatile uint8_t*)0xE000E428) = 0xe0;  // 40<br>
>         (*(volatile uint8_t*)0xE000E417) = 0x50;  //23<br>
>         (*(volatile uint8_t*)0xE000E428) = 0x50;  // 40<br>
> <br>
> <br>
> <br>
>     // 23 40 Interrupt set-enable register x (NVIC_ISERx)<br>
>         // nvic enable interrupter number<br>
>         // 0xE000E100<br>
>         (*(volatile uint32_t*)0xE000E100) |= (1<<23);<br>
>         (*(volatile uint32_t *)0xE000E104) |= (1<< (40%32));<br>
>     } <br>
> <br>
> <br>
> On Thu, Jun 20, 2019 at 4:05 PM Christian Mauderer <<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a><br>
> <mailto:<a href="mailto:list@c-mauderer.de" target="_blank">list@c-mauderer.de</a>>> wrote:<br>
> <br>
>     On 20/06/2019 05:28, Jython wrote:<br>
>     > hi, it seems that exit key interrupt won't stop sleep mode, why?<br>
>     ><br>
>     > [...]<br>
>     ><br>
> <br>
>     What do you mean by "exit key interrupt"? I don't know the STM32F4 that<br>
>     well. So please give some more details.<br>
> <br>
>     I would expect that either only specific interrupt sources can wake up<br>
>     the processor from a deep sleep mode or that you can configure which<br>
>     peripherals are still active. If your "exit key" is a GPIO line with<br>
>     interrupt capability you should have a look at whether the module is<br>
>     still active.<br>
> <br>
>     Best regards<br>
> <br>
>     Christian<br>
> <br>
>     _______________________________________________<br>
>     users mailing list<br>
>     <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a> <mailto:<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>><br>
>     <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
> <br>
<br>
</blockquote></div>