SWRA495K December 2015 – April 2024 CC1310 , CC1350 , CC2620 , CC2630 , CC2640 , CC2640R2F , CC2640R2F-Q1 , CC2642R-Q1 , CC2650 , CC2662R-Q1
The following code can be used to measure the approximate turn on time of the high frequency crystal for CC26X2 and CC13X2 devices. This function works by counting the number of low frequency clock edges from the enabling of the high frequency clock to the high frequency clock being qualified. For more accurate results, external measurement equipment is required.
uint32_t OSCHF_DebugGetCrystalStartupTime( void )
{
uint32_t lfEdgesFound = 0 ;
// Start operation in sync with the LF clock
HWREG( AON_RTC_BASE + AON_RTC_O_SYNCLF );
OSCHF_TurnOnXosc();
while ( ! OSCHF_AttemptToSwitchToXosc() ) {
HWREG( AON_RTC_BASE + AON_RTC_O_SYNCLF );
lfEdgesFound ++ ;
}
OSCHF_SwitchToRcOscTurnOffXosc();
return ( lfEdgesFound );
}
For CC26XX and CC13XX, and CC26X2 and CC13X2 devices, the crystal startup time may also be measured using built in driverlib implementation of OSCHF_DebugGetCrystalStartupTime().