You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2023/10/26 06:45:26 UTC
[mynewt-core] branch master updated (156ea82a0 -> 48e433326)
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
from 156ea82a0 tinyusb/dfu: Fix build when auto confirm is off
new b02b2ac75 stm32: Fix RTC based tick day change
new 48e433326 stm32: Fix RTC based hal tick for STM32U5
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
hw/mcu/stm/stm32_common/src/hal_os_tick.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
[mynewt-core] 01/02: stm32: Fix RTC based tick day change
Posted by je...@apache.org.
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
commit b02b2ac751670a7db99dd385bb0d9df39db8e06a
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Sun Oct 22 23:43:20 2023 +0200
stm32: Fix RTC based tick day change
On starting next calendar day, result of computing time
difference between current time and previous one was negative
and should be corrected by whole day on sub seconds.
It was corrected by one hour instead resulting in
negative tick increment that caused crash at midnight.
This change fixes issue by correcting time difference computation.
---
hw/mcu/stm/stm32_common/src/hal_os_tick.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 4a989f076..d56bc2dd6 100644
--- a/hw/mcu/stm/stm32_common/src/hal_os_tick.c
+++ b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
@@ -156,7 +156,8 @@ rtc_update_time(void)
now = rtc_time_to_sub_seconds(&alarm.AlarmTime);
delta = now - last_rtc_time;
if (delta < 0) {
- delta += 3600 << SUB_SECONDS_BITS;
+ /* Day changed, correct delta */
+ delta += (24 * 3600) << SUB_SECONDS_BITS;
}
alarm.AlarmTime.SubSeconds = alarm.AlarmTime.SecondFraction - (now & alarm.AlarmTime.SecondFraction);
alarm.AlarmTime.SubSeconds -= sub_seconds_per_tick;
[mynewt-core] 02/02: stm32: Fix RTC based hal tick for STM32U5
Posted by je...@apache.org.
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
commit 48e4333262bae6785707a0f49e96dde82d992431
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Sun Oct 22 23:46:21 2023 +0200
stm32: Fix RTC based hal tick for STM32U5
It fixes IRQ number to reflect correct name for STM32U5
It also enables additional clocks that are need to access
RTC data on STM32U5
Aldo STM32U5 does not have DBGMCU_CR_DBG_SLEEP field similar to STM32F1.
---
hw/mcu/stm/stm32_common/src/hal_os_tick.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
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 d56bc2dd6..166709f8a 100644
--- a/hw/mcu/stm/stm32_common/src/hal_os_tick.c
+++ b/hw/mcu/stm/stm32_common/src/hal_os_tick.c
@@ -69,7 +69,7 @@ __WFI(void)
#define SYNCH_PREDIV (32768 / (ASYNCH_PREDIV + 1) - 1)
#define SUB_SECONDS_BITS 12
-#if defined(STM32L0) || defined(STM32F0)
+#if defined(STM32L0) || defined(STM32F0) || defined(STM32U5)
#define RTC_IRQ RTC_IRQn
#else
#define RTC_IRQ RTC_Alarm_IRQn
@@ -320,6 +320,12 @@ os_tick_init(uint32_t os_ticks_per_sec, int prio)
NVIC_SetPriority(RTC_IRQ, prio);
NVIC_SetVector(RTC_IRQ, (uint32_t)RTC_Alarm_IRQHandler);
+#ifdef __HAL_RCC_RTCAPB_CLK_ENABLE
+ __HAL_RCC_RTCAPB_CLK_ENABLE();
+#endif
+#ifdef __HAL_RCC_RTCAPB_CLKAM_ENABLE
+ __HAL_RCC_RTCAPB_CLKAM_ENABLE();
+#endif
/* If RTC is already on get time and date before reinit. */
if (IS_RTC_ENABLED) {
HAL_RTC_GetTime(&rtc, &rtc_time, RTC_FORMAT_BIN);
@@ -331,10 +337,10 @@ os_tick_init(uint32_t os_ticks_per_sec, int prio)
__HAL_DBGMCU_FREEZE_RTC();
-#if !MYNEWT_VAL(MCU_STM32F0)
- DBGMCU->CR |= (DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
-#else
+#if MYNEWT_VAL(MCU_STM32F0) || MYNEWT_VAL(MCU_STM32U5)
DBGMCU->CR |= (DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
+#else
+ DBGMCU->CR |= (DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
#endif
OS_ENTER_CRITICAL(sr);