Hi,
What do you think about ST based on RTC? I have implemented first version for STM32L4.
Reason: ST based on RTC provides precise time measurement in Low Power STOP mode (ST is active in STOP mode). There is a problem with precise time measurement with ST based on TIMx in Low Power Sleep mode due to latency in code execution after changing sys clock to lowest frequency and instability of MSI frequency.
Chibios HAL changes:
st_lld.h/st_lld.c: RTC support added, including RTC alarm interrupt handler
ext_lld.c: RTC alarm line masking added
ext_lld_isr.h/ext_lld_isr.c: RTC alarm line mask macro added, disabling RTC alarm interrupt handler
hal_lld.c: RTC initialisation if ST use RTC and HAL_USE_RTC disabled
Restrictions:
HAL_USE_RTC should be FALSE
RTC clock source should be LSE
CH_CFG_ST_FREQUENCY should be equal to (32768 / (STM32_RTC_PRESS_VALUE * STM32_RTC_PRESA_VALUE)
There is uint16_t century counter, so device can work without calendar errors more than 100 years on 2048Hz ST frequency
There is no debug support for RTC
Date Algorithms for RTC based on: http://howardhinnant.github.io/date_algorithms.html
I will share sources here a little bit later.
STM32 ST based on RTC
Re: STM32 ST based on RTC
STM32L1 and L0 implementation is attached. ChibiOS 17.6.0.
- Attachments
-
- rtc_st.tar.gz
- (14.58 KiB) Downloaded 227 times
Vitaly
Who is online
Users browsing this forum: No registered users and 24 guests