Entering power off now disables FSMC
// See LICENSE file in the project root for full license information.
//
+#include <ch.h>
+#include <hal.h>
+#include <hal_nf_community.h>
#include <nanoHAL_Power.h>
#include <nanoHAL_v2.h>
#include <target_platform.h>
#include <cmsis_os.h>
-#include <hal.h>
-#include <hal_nf_community.h>
-#include <ch.h>
+
+#if (HAL_USE_FSMC == TRUE)
+#include <fsmc_sdram_lld.h>
+#endif
uint32_t WakeupReasonStore;
@@ -42,6 +46,11 @@ void CPU_SetPowerMode(PowerLevel_type powerLevel)
// stop watchdog
wdgStop(&WDGD1);
+ #if (HAL_USE_FSMC == TRUE)
+ // shutdown memory
+ fsmcSdramStop(&SDRAMD);
+ #endif
+
// gracefully shutdown everything
nanoHAL_Uninitialize_C();
