找回密码
 立即注册
查看: 825|回复: 17

能不能用外部32768计算得到内部IRC的准确频率

[复制链接]
  • 打卡等级:初来乍到
  • 打卡总天数:3
  • 最近打卡:2024-10-31 10:38:52

6

主题

20

回帖

120

积分

注册会员

积分
120
发表于 2024-8-17 22:04:17 | 显示全部楼层 |阅读模式
能不能用外部32768计算得到内部IRC的准确频率,不需要追频,只需要得到内部IRC的准确频率就可以了,用作时间计数,C8051F411可以用内部IRC的频率就捕获外部32768的几个周期,从而以32768为基准反算得到当前内部的准确频率,用这个频率做计数器,实现低功耗高速计数。
回复

使用道具 举报 送花

  • 打卡等级:偶尔看看III
  • 打卡总天数:55
  • 最近打卡:2025-05-02 08:32:59

718

主题

1万

回帖

1万

积分

管理员

积分
15632
发表于 2024-8-18 10:34:56 | 显示全部楼层
截图202408181032275354.jpg


截图202408181033087724.jpg


截图202408181033445660.jpg


截图202408181034527919.jpg

回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:3
  • 最近打卡:2024-10-31 10:38:52

6

主题

20

回帖

120

积分

注册会员

积分
120
发表于 2024-8-17 22:13:52 | 显示全部楼层
32768做定期唤醒和校准用,使用的无源晶振
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:425
  • 最近打卡:2025-05-03 00:09:43
已绑定手机

77

主题

4850

回帖

8388

积分

超级版主

DebugLab

积分
8388
发表于 2024-8-17 22:20:47 | 显示全部楼层
使用内部预置频率,不需要计算
DebugLab
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:424
  • 最近打卡:2025-05-03 00:02:01
已绑定手机

19

主题

3191

回帖

4876

积分

论坛元老

积分
4876
发表于 2024-8-17 22:34:55 | 显示全部楼层
这个还真不行。
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:偶尔看看III
  • 打卡总天数:55
  • 最近打卡:2025-05-02 08:32:59

718

主题

1万

回帖

1万

积分

管理员

积分
15632
发表于 2024-8-18 10:39:01 | 显示全部楼层
截图202408181037215454.jpg


截图202408181038563618.jpg

回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:3
  • 最近打卡:2024-10-31 10:38:52

6

主题

20

回帖

120

积分

注册会员

积分
120
发表于 2024-8-19 09:08:03 | 显示全部楼层

CRE只能做到0.5%,我需要用外部32768为标准知道内部跑的准确频率,用以高速计数,CRE又不能知道准确跑的频率,误差太大,用外部就是用上了外部的20ppm频率稳定性,内部跑偏一点无所谓,实时校准
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 2024-8-19 16:58:49 | 显示全部楼层
tianp*** 发表于 2024-8-19 09:08
CRE只能做到0.5%,我需要用外部32768为标准知道内部跑的准确频率,用以高速计数,CRE又不能知道准确跑的 ...

Internal RC oscillators jitter by in the ball park of 1 part in 10,000, so that limits how 'exact' you can hope to be.
The CRE auto calibrate appears to sample SYSCLK at 32k/16, or 488.3us, but only has choices of 1ms-64ms correction rates, so it will lose long term tracking information, but may be good enough for some values of exact.
One example gives a CRE capture value of 16*40M/32678 = 19531.25, so choosing a value of 19531 will give a mean seek frequency of 39.999488MHz.
It will step by the trim step of ~ 0.3% but the long term average should be better than 0.3%,  and may approach ~ 51ppm ( 1/19531) if the variations are random.
However, because the correction is always chasing the correct frequency short term variations may be worse than without the locking system enabled.

An alternative approach is to use the RTC 1/32 interrupt, to read a 24b timer, and keep an update of the long term difference.
eg a timer with a prescaler of /24 and read every 1/32 second at 40MHz will accumulate 40M/32/24 = 52083.33333 on average, so you can read to around 19ppm, far better than the one part in 10,000 of a RC oscillator. This reading will vary with voltage and temperature, but will not have the 0.3% jumps of the auto-calibrate.
  

回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家I
  • 打卡总天数:369
  • 最近打卡:2025-05-02 13:01:49

1

主题

80

回帖

1552

积分

金牌会员

积分
1552
发表于 2024-8-20 05:53:17 | 显示全部楼层
如果已知外部频率,可以参考频率计做法,对外部晶振或其分频做计数,倒推内部时钟误差.
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:3
  • 最近打卡:2024-10-31 10:38:52

6

主题

20

回帖

120

积分

注册会员

积分
120
发表于 2024-8-20 14:39:18 | 显示全部楼层
jm*** 发表于 2024-8-19 16:58
Internal RC oscillators jitter by in the ball park of 1 part in 10,000, so that limits how 'exact ...

用RTC的分频中断是个好主意,但无奈这个是个软件方案,非硬件方案,可能也是该款单片机目前最好的方案
回复 支持 反对

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2025-5-3 05:33 , Processed in 0.147311 second(s), 122 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表