![shequ.stmicroelectronics.cn](./template/st_v1/static/img/logo2.png)
在开启RTC后,频繁读取RTC时间,出现在跨天的时候天数无法累加,不知道有没有小伙伴遇到同样的问题? (例如时间19-01-01 23:59:50->19-01-02 00:00:02的过程成,频繁读取RTC时间,基本为1S读一次,在跨天后读取出来的时间值为19-01-01 00:00:01) 不知道这由什么问题导致的? RTC_Wait_For_Synchro();//Waiting for synchronization RTC_Date_TYPE *pDate = (RTC_Date_TYPE *)&RTC->DR; RTC_Time_TYPE *pTime = (RTC_Time_TYPE *)&RTC->TR; UINT16 tmpreg = RTC->SSR; rtc->SSeconds = ((RTC_SYNCHRONOUS_PRESCALER-tmpreg)*125)>>5; rtc->Year.ALL = pDate->Year; rtc->Month.ALL = pDate->Month&0x1f; rtc->Date.ALL = pDate->Date; rtc->Hours.ALL = pTime->Hours&0x3f; rtc->Minutes.ALL = pTime->Minutes; rtc->Seconds.ALL = pTime->Seconds; |
STM32L07系列低功耗串口应用
stm32L0系列串口稳定性
谁有STM32L051的数据手册RM0377和编程手册PM0223的中文版,
查之前我的提问
关于STM32L的运行功耗和手册不对应的问题
F030系列与L031系列
有关双bank现场升级的一些问题,图片为官方代码
STEVAL-SMARTAG1$ NFC板资料那里有?
STM32L051K8U6没有供电时,io是不是高阻态?
RTC的问题
先读日期再读时间就会有这种问题吗?
hal的库也都只是独立封装出来,效果应该都是一样的吧
in the higher-order calendar shadow registers to ensure consistency between the time and date values.
Reading RTC current time locks the values in calendar shadow registers until Current date is read.
官方note
You must call HAL RTC GetDate() after HAL RTC GetTime() to unlock the values
in the higher-order calendar shadow registers to ensure consistency between the time and date values.
Reading RTC current time locks the values in calendar shadow registers until Current date is read.