Skip to main content
pgspro1
Visitor II
March 8, 2019
Question

HAL_PWR_EnterSLEEPMode() needs to have a __DSB() before the __WFI() or __WFE() according to ARM documentation

  • March 8, 2019
  • 1 reply
  • 1807 views

According to ARM Cortex-A Series Programmer’s Guide for ARMv8-A:

15.1.2. Standby

...

This mode is entered using either the WFI (Wait For Interrupt) or WFE (Wait For Event) instructions. ARM recommends the use of a Data Synchronization Barrier (DSB) instruction before WFI or WFE, to ensure that pending memory transactions complete before changing state.

--> The HAL function HAL_PWR_EnterSLEEPMode() does not perform the DSB instruction before the WFE or WFI instruction. I believe that this is an error in the HAL code.

This topic has been closed for replies.

1 reply

Piranha
Principal III
March 9, 2019

While the main point is correct, one should refer to Cortex-M documentation, not Cortex-A.

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHICBGB.html

ST's developers are systematically ignoring needed memory barriers everywhere. That's one of the reasons their ETH/lwIP drivers are so flawed that they are basically non-working. Now on a fast Cortex-M7 based MCUs it is showing off in it's full glory of instability. And it has been reported in this forum multiple times years ago...