diff --git a/stmhal/rtc.c b/stmhal/rtc.c
index 00821cabb3488b45e8fc75d06e874579ff186b57..91dae0d6eb7e72794db564dba00d41e0d5ecdd52 100644
--- a/stmhal/rtc.c
+++ b/stmhal/rtc.c
@@ -464,7 +464,7 @@ mp_obj_t pyb_rtc_wakeup(mp_uint_t n_args, const mp_obj_t *args) {
         // set WUTIE to enable wakeup interrupts
         // set WUTE to enable wakeup
         // program WUCKSEL
-        RTC->CR |= (1 << 14) | (1 << 10) | (wucksel & 7);
+        RTC->CR = (RTC->CR & ~7) | (1 << 14) | (1 << 10) | (wucksel & 7);
 
         // enable register write protection
         RTC->WPR = 0xff;