diff --git a/os/hal/ports/STM32/LLD/SYSTICKv2/hal_st_lld.c b/os/hal/ports/STM32/LLD/SYSTICKv2/hal_st_lld.c index 3d0cc0e80..778ecfd9b 100644 --- a/os/hal/ports/STM32/LLD/SYSTICKv2/hal_st_lld.c +++ b/os/hal/ports/STM32/LLD/SYSTICKv2/hal_st_lld.c @@ -109,7 +109,10 @@ void st_lld_init(void) { /* Activate free running Binary mode.*/ RTC->ICSR |= RTC_ICSR_BIN_0; - /* Set RTC prescaler.*/ + /* Set RTC prescaler. + Setting PRER has to be done as two writes. Write Sync part first + then Sync + Async. */ + RTC->PRER = STM32_ST_RTC_PRER_BITS & 0x7FFF; RTC->PRER = STM32_ST_RTC_PRER_BITS; /* Exit initialization mode.*/