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 5a37e2248 hw/mcu/stm32: Disable SysTick when RTC is selected as tick
source
5a37e2248 is described below
commit 5a37e2248a41097c9958fa95ca17dc11f15cee38
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sun Jul 7 00:03:42 2024 +0200
hw/mcu/stm32: 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.
Same code was already applied to STM32F1 that has different
RTC block.
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
hw/mcu/stm/stm32_common/src/hal_os_tick.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/mcu/stm/stm32_common/src/hal_os_tick.c
b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
index 4a2869078..ab512f0c4 100644
--- a/hw/mcu/stm/stm32_common/src/hal_os_tick.c
+++ b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
@@ -307,6 +307,12 @@ os_tick_init(uint32_t os_ticks_per_sec, int prio)
.PeriphClockSelection = RCC_PERIPHCLK_RTC,
.RTCClockSelection = RCC_RTCCLKSOURCE_LSE,
};
+ /*
+ * Disable SysTick so only one interrupt advances time.
+ * this is needed when bootloader enabled SysTick
+ */
+ SysTick->CTRL = 0;
+
HAL_RCCEx_PeriphCLKConfig(&clock_init);
/* Set the system tick priority. */