tianpeng0 发表于 2024-8-17 22:04:17

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

能不能用外部32768计算得到内部IRC的准确频率,不需要追频,只需要得到内部IRC的准确频率就可以了,用作时间计数,C8051F411可以用内部IRC的频率就捕获外部32768的几个周期,从而以32768为基准反算得到当前内部的准确频率,用这个频率做计数器,实现低功耗高速计数。

神农鼎 发表于 2024-8-18 10:34:56












tianpeng0 发表于 2024-8-17 22:13:52

32768做定期唤醒和校准用,使用的无源晶振

DebugLab 发表于 2024-8-17 22:20:47

使用内部预置频率,不需要计算

soma 发表于 2024-8-17 22:34:55

这个还真不行。

神农鼎 发表于 2024-8-18 10:39:01






tianpeng0 发表于 2024-8-19 09:08:03

神农鼎 发表于 2024-8-18 10:39


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

jmg 发表于 2024-8-19 16:58:49

tianpeng0 发表于 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.


cdpzq 发表于 2024-8-20 05:53:17

如果已知外部频率,可以参考频率计做法,对外部晶振或其分频做计数,倒推内部时钟误差.

tianpeng0 发表于 2024-8-20 14:39:18

jmg 发表于 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的分频中断是个好主意,但无奈这个是个软件方案,非硬件方案,可能也是该款单片机目前最好的方案
页: [1] 2
查看完整版本: 能不能用外部32768计算得到内部IRC的准确频率