This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d2f840cc hw/mcu/stm32f1: Disable SysTick when RTC is selected as tick 
source
6d2f840cc is described below

commit 6d2f840ccd2981e18088a588baf23af160ac757b
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Jun 12 12:37:27 2024 +0200

    hw/mcu/stm32f1: Disable SysTick when RTC is selected as tick source
    
    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]>
---
 hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c 
b/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
index 3220991f3..9f27be4f1 100644
--- a/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
+++ b/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
@@ -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();

Reply via email to