Part Number: CC2340R2
Hi team,
I noticed that the function that selects the external clock source for the low frequency clock changed in the new SDK (v9.11). We had to copy this function and change the expected frequency to 32.768kHz in our code using SDK (v8.40).
The differences I want to ask about are:
1) Why is the setting of the mux now done first?
2) The setting up of LFK good interrupt is new
3) Enabling the LFK Good interrupt is new
Can you share any details on why these changes were made and if there are any effects on the older SDK (v8.40)?
//From new SDK(Simplink_lowpower_f3_SDK_9_11_00_18)
/*
* ======== PowerLPF3_selectEXTLF ========
*/
void PowerLPF3_selectEXTLF(void)
{
/* Configure EXTLF to the right mux */
GPIO_setConfigAndMux(PowerLPF3_extlfPin, GPIO_CFG_INPUT, PowerLPF3_extlfPinMux);
Log_printf(LogModule_Power, Log_INFO, "PowerLPF3_selectEXTLF: EXTLF pin muxing configured");
/* Set LFINC override to 31.25 kHz.
*
* The value is calculated as period in microseconds with 16 fractional
* bits.
* The EXTLF runs at 31.25 kHz -> 1 / 31250 Hz = 32 us.
* 32 * 2^16 = 2097152 = 0x00200000
*/
HWREG(CKMD_BASE + CKMD_O_LFINCOVR) = 0x00200000 | CKMD_LFINCOVR_OVERRIDE;
/* Directly switch to EXTLF, LFTICK will be generated by HFOSC until EXTLF
* is running.
*/
HWREG(CKMD_BASE + CKMD_O_LFCLKSEL) = CKMD_LFCLKSEL_MAIN_EXTLF;
/* Set EXTLF qualification function to be called by
* PowerCC23X0_oscillatorISR(). This function will return true when getting
* the LFCLKGOOD interrupt.
*/
PowerLPF3_lfclkQualFxn = PowerCC23X0_extlfQual;
/* Disallow standby until LF clock is running.
* The PowerCC23X0_oscillatorISR() function will release the constraint once
* PowerLPF3_lfclkQualFxn returns true.
*/
Power_setConstraint(PowerLPF3_DISALLOW_STANDBY);
/* Enable LFCLKGOOD interrupts */
HWREG(CKMD_BASE + CKMD_O_IMSET) = CKMD_IMASK_LFCLKGOOD;
}
//From Old SDK (Simplelink_lowpower_f3_sdk_8_40_00_61)
/*
* ======== PowerLPF3_selectEXTLF ========
*/
void PowerLPF3_selectEXTLF(void)
{
/* Set LFINC override to 31.25 kHz.
*
* The value is calculated as period in microseconds with 16 fractional
* bits.
* The EXTLF runs at 31.25 kHz -> 1 / 31250 Hz = 32 us.
* 32 * 2^16 = 2097152 = 0x00200000
*/
HWREG(CKMD_BASE + CKMD_O_LFINCOVR) = 0x00200000 | CKMD_LFINCOVR_OVERRIDE;
/* Set LFCLK to EXTLF */
HWREG(CKMD_BASE + CKMD_O_LFCLKSEL) = CKMD_LFCLKSEL_MAIN_EXTLF;
/* Configure EXTLF to the right mux */
GPIO_setConfigAndMux(PowerLPF3_extlfPin, GPIO_CFG_INPUT, PowerLPF3_extlfPinMux);
/* Enable LFCLKGOOD */
HWREG(CKMD_BASE + CKMD_O_IMSET) = CKMD_IMASK_LFCLKGOOD;
/* Disallow standby until LF clock is running. Otherwise, we will only
* vector to the ISR after we wake up from standby the next time since the
* CKM interrupt is purposefully not configured as a wakeup source.
*/
Power_setConstraint(PowerLPF3_DISALLOW_STANDBY);
Log_printf(LogModule_Power, Log_INFO, "PowerLPF3_selectEXTLF: EXTLF selected");
}
Best,
Luke