Skip to content

Commit

Permalink
hw/mcu/stm32f1: Disable SysTick when RTC is selected as tick source
Browse files Browse the repository at this point in the history
When tick was provided by RTC instead of SysTick (default)
and MCUboot used SysTick during boot, SysTick was never turned off
and was running in application code.
This resulted in two interrupts advancing mynewt OS tick so clock
was running too fast.

Now os_tick_init() from RTC code disables SysTick that could be
started in bootloader

Signed-off-by: Jerzy Kasenberg <[email protected]>
  • Loading branch information
kasjer committed Jun 12, 2024
1 parent e8277f3 commit 3d13be8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ os_tick_init(uint32_t os_ticks_per_sec, int prio)
.PeriphClockSelection = RCC_PERIPHCLK_RTC,
.RTCClockSelection = RCC_RTCCLKSOURCE_LSE,
};
SysTick->CTRL = 0;

HAL_RCCEx_PeriphCLKConfig(&clock_init);
__HAL_RCC_RTC_ENABLE();
Expand Down

0 comments on commit 3d13be8

Please sign in to comment.