打印
[STM32F4]

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

[复制链接]
125|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 | 只看该作者
供电问题

使用特权

评论回复
5
stormwind123| | 2023-12-21 09:59 | 只看该作者
检查软件配置、时钟源等

使用特权

评论回复
6
淡漠安然| | 2024-1-17 15:22 | 只看该作者
估计是你的RTC操作有问题吧

使用特权

评论回复
7
江河千里| | 2024-1-17 18:00 | 只看该作者
是不是你用的函数不对啊?

使用特权

评论回复
8
冰春彩落下| | 2024-1-17 20:00 | 只看该作者
一般情况,这种RTC好像不是很稳,不如外置的RTC好用

使用特权

评论回复
9
别乱了阵脚| | 2024-1-17 22:00 | 只看该作者
这是不是RTC跑时间了?导致日期过了凌晨,也还是前一天

使用特权

评论回复
10
暖了夏天蓝了海| | 2024-1-18 15:00 | 只看该作者
你这12-12-12日期好像也不是很对吧?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

389

主题

1464

帖子

3

粉丝