diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 7c8104b13089aaedee65142123b7efb96f4bcef9..06c07812c0c41dfd4210f151697f42be1f5ab37a 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -105,6 +105,12 @@ void machine_init(void) {
         reset_cause = PYB_RESET_DEEPSLEEP;
         PWR->CPUCR |= PWR_CPUCR_CSSF;
     } else
+    #elif defined(STM32L4)
+    if (PWR->SR1 & PWR_SR1_SBF) {
+        // came out of standby
+        reset_cause = PYB_RESET_DEEPSLEEP;
+        PWR->SCR |= PWR_SCR_CSBF;
+    } else
     #endif
     {
         // get reset cause from RCC flags