[STM32F4] STM32F407 RTC读日期错误是什么原因

[复制链接]
769|9
 楼主| onlycook 发表于 2023-12-20 11:18 | 显示全部楼层 |阅读模式
使用STM32F407 标准库的RTC例程,调用函数RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure);读取日期,每5S读一次,发现在每天的凌晨时,小时值读出来,可以从23:59:59 正确的读到第2天的00:00:04S,而日期值在过凌晨后,还是前一天的日期,大约再读1分钟得样子,日期读出来才更新,不知道是什么原因,望各位朋友帮忙分析分析,谢谢。
The current time is :  12-12-12 23:59:56
The current time is :  12-12-12 23:59:59
The current time is :  12-12-12 00:00:04
The current time is :  12-12-12 00:00:09
The current time is :  12-12-12 00:00:14
The current time is :  12-12-12 00:00:19
The current time is :  12-12-12 00:00:24
The current time is :  12-12-12 00:00:29
The current time is :  12-12-12 00:00:34
The current time is :  12-12-12 00:00:39
The current time is :  12-12-12 00:00:44
The current time is :  12-12-12 00:00:49
The current time is :  12-12-12 00:00:54
The current time is :  12-12-12 00:00:59
The current time is :  12-12-12 00:01:04
The current time is :  12-12-12 00:01:09
The current time is :  12-12-12 00:01:14
The current time is :  12-12-12 00:01:19
The current time is :  12-12-12 00:01:24
The current time is :  12-12-13 00:01:29
The current time is :  12-12-13 00:01:34
probedog 发表于 2023-12-21 09:58 | 显示全部楼层
RTC的时钟源可能不稳定或存在误差,导致日期和时间的计算不准确。
laocuo1142 发表于 2023-12-21 09:58 | 显示全部楼层
RTC的分频值可能设置不正确
powerantone 发表于 2023-12-21 09:58 | 显示全部楼层
供电问题
stormwind123 发表于 2023-12-21 09:59 | 显示全部楼层
检查软件配置、时钟源等
淡漠安然 发表于 2024-1-17 15:22 | 显示全部楼层
估计是你的RTC操作有问题吧
江河千里 发表于 2024-1-17 18:00 | 显示全部楼层
是不是你用的函数不对啊?
冰春彩落下 发表于 2024-1-17 20:00 | 显示全部楼层
一般情况,这种RTC好像不是很稳,不如外置的RTC好用
别乱了阵脚 发表于 2024-1-17 22:00 | 显示全部楼层
这是不是RTC跑时间了?导致日期过了凌晨,也还是前一天
暖了夏天蓝了海 发表于 2024-1-18 15:00 | 显示全部楼层
你这12-12-12日期好像也不是很对吧?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

496

主题

2185

帖子

4

粉丝
快速回复 在线客服 返回列表 返回顶部