Part Number: CC2340R5
Tool/software:
Continuing the topic of the linked article, I used an external oscillator 48M Timer to read the value of RTC TIME8U. Whether the calibration time is 1 second or 5 minutes, it is very close to the ideal value. This is very strange to me. According to the test report given by TI FAE, the ppm error of the internal 32.768K is as shown below


According to these data, the average ppm error of 32.768K will fall around -100ppm. However, I use 48M Timer for calibration. No matter how many times I test, the error value per second is at most 2 counts. Because it is the value of TIME8U, it is about 16us after conversion per second, which is inconsistent with the data. The calibration method is as follows:
/* ----Calibration RTC Timer Initial ---- */
hTimer_RTC = NULL;
LGPTimerLPF3_Params LGPparams_RTC;
LGPTimerLPF3_Params_init(&LGPparams_RTC);
LGPparams_RTC.hwiCallbackFxn = Calibration_RTCTimerCallback;
LGPparams_RTC.prescalerDiv = 48 - 1;
uint32_t counterTarget_RTC;
hTimer_RTC = LGPTimerLPF3_open(CONFIG_LGPTIMER_1, &LGPparams_RTC);
if(hTimer == NULL)
{
// while(1){}
}
counterTarget_RTC = 1000 - 1; // 8ms with a system clock of 48MHz
LGPTimerLPF3_setInitialCounterTarget(hTimer_RTC, counterTarget_RTC, true);
g_tRTC.uiRTC_Calibration_Count = 0;
g_tRTC.uiRTC_Calibration_8us_old = HWREG(RTC_BASE + RTC_O_TIME8U);
LGPTimerLPF3_enableInterrupt(hTimer_RTC, LGPTimerLPF3_INT_TGT);
LGPTimerLPF3_start(hTimer_RTC, LGPTimerLPF3_CTL_MODE_UP_PER);void Calibration_RTCTimerCallback(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask)
{
g_tRTC.uiRTC_Calibration_Count++;
if(g_tRTC.uiRTC_Calibration_Count >= 1000)
{
g_tRTC.uiRTC_Calibration_8us = HWREG(RTC_BASE + RTC_O_TIME8U);
LGPTimerLPF3_disableInterrupt (hTimer_RTC, LGPTimerLPF3_INT_TGT);
LGPTimerLPF3_stop(hTimer_RTC);
if(g_tRTC.uiRTC_Calibration_8us < g_tRTC.uiRTC_Calibration_8us_old)
g_tRTC.iRTC_Calibration_8us_diff = (g_tRTC.uiRTC_Calibration_8us + 0xFFFFFFFF) + g_tRTC.uiRTC_Calibration_8us_old;
else
g_tRTC.iRTC_Calibration_8us_diff = g_tRTC.uiRTC_Calibration_8us - g_tRTC.uiRTC_Calibration_8us_old;
g_tRTC.dRTC_Calibration_perSecond = ((double)g_tRTC.iRTC_Calibration_8us_diff - 125000) * 0.000008;
}
}
I also made sure that the syscfg in the project settings was correctly set to LF RCOSC
1. I suspect that when the 48M Timer is running, the RTC is also running with a 48M oscillator, resulting in a large difference between the calibration value and the data value. In other words, the RTC is actually equal to 48M, resulting in the theoretical values of the RTC and 48M being almost the same
2. Is there a way to ensure that when using the 48M Timer, the RTC clock source is definitely using the internal 32.768K oscillator?