aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/platforms/STM32/RTCv2/rtc_lld.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/os/hal/platforms/STM32/RTCv2/rtc_lld.c b/os/hal/platforms/STM32/RTCv2/rtc_lld.c
index 870734fba..84295bd76 100644
--- a/os/hal/platforms/STM32/RTCv2/rtc_lld.c
+++ b/os/hal/platforms/STM32/RTCv2/rtc_lld.c
@@ -105,8 +105,10 @@ void rtc_lld_init(void){
rtc_lld_enter_init();
/* Prescaler register must be written in two SEPARATE writes. */
- RTCD1.id_rtc->PRER = prediv_a << 16;
- RTCD1.id_rtc->PRER = ((STM32_RTCCLK / (prediv_a + 1)) - 1) & 0x7FFF;
+ prediv_a = (prediv_a << 16) |
+ (((STM32_RTCCLK / (prediv_a + 1)) - 1) & 0x7FFF);
+ RTCD1.id_rtc->PRER = prediv_a;
+ RTCD1.id_rtc->PRER = prediv_a;
rtc_lld_exit_init();
}
}