Skip to main content
OBili.2132
Associate
December 6, 2019
Question

STM32F446ZE doesn't enter in Standby mode

  • December 6, 2019
  • 2 replies
  • 1512 views

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.

2 replies

waclawek.jan
Super User
December 7, 2019

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
December 7, 2019

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
December 7, 2019

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
December 7, 2019

Thanks a lot

Oleksii​