Skip to main content
OBili.2132
Associate
Dec 6, 2019 1:41 PM UTC
Question

STM32F446ZE doesn't enter in Standby mode

Hi,

I am using Standby mode on STM32F446ZE, but I faced with a problem. Sometimes MCU doesn't enter in this mode. Exiting Standby mode via RTC wakeup.

Below is present steps which I perform for entering Standby

SCB->SCR |= 0x00000004;

PWR->CR |= 0x00000002;

PWR->CR |= 0x00000004;  

 __WFI();

Could you check if it is correct?

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
Dec 7, 2019 5:51 AM UTC

Looks good at the first sight, but PWR_CR.WUF bit has this in its description:

1: Clear the WUF Wakeup Flag after 2 System clock cycles

so you may need to insert a few NOPs or rearrange the code.

Also make sure there's no other interrupt pending when trying to enter standby.

JW

Piranha
Principal III
Dec 7, 2019 9:56 AM UTC

NOP is not guaranteed be time-consuming at all... They should be used only for alignment purposes. Dummy read is a safer approach.

waclawek.jan
Super User
Dec 7, 2019 10:25 AM UTC

In Cortex-M4 there's no mechanism which would prevent NOP from being executed (i.e. early decoding, pipeline-level skip). I don't say it's the best option though, and certainly not if you intend to migrate to 'M7 or any other core where performance is achieved by giving up "straighforwardness".

I prefer code reorganisation as primary source of timing, as it's cheap. Here WUF could be possible cleared after wakeup - but I don't use actively low-power modes so maybe this scheme would have some substantial shortcomings.

JW

OBili.2132
Associate
Dec 7, 2019 6:48 AM UTC

Thanks a lot

​

Oleksii​