Question
HAL_PWR_EnterSLEEPMode() needs to have a __DSB() before the __WFI() or __WFE() according to ARM documentation
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.
