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 6f5cef0bb stm32f1/rtc_tick: Fix tick interrupt generation
6f5cef0bb is described below

commit 6f5cef0bb94fb9eacfe3b9431796b9499306ddf6
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Jun 5 23:48:51 2024 +0200

    stm32f1/rtc_tick: Fix tick interrupt generation
    
    When RTC (STM32F1 specific only) was used as os tick source.
    If OS requested longer tickles time RTC alarm was set to
    some time in the future.
    After WFI finished RTC periodic tick interrupt was not
    enabled. If then some task took more time and periodically
    checked time, time would never advance due to RTC tick
    interrupt being disabled.
    Time would advance only in idle task.
    Now normal tick is working all the time unless there is
    nothing to do and after WFI finishes tick is enabled again.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c 
b/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
index febceda4e..3220991f3 100644
--- a/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
+++ b/hw/mcu/stm/stm32f1xx/src/rtc_tick_stm32f1xx.c
@@ -108,6 +108,8 @@ os_tick_idle(os_time_t ticks)
          */
         stm32_os_tick_update_rtc();
     }
+    /* Disable alarm, enable tick interrupt. */
+    RTC->CRH = RTC_CRH_SECIE_Msk;
 }
 
 void

Reply via email to