Silicon Labs EFM32: How should the pins be set when using an external oscillator?
Use HFXTAL_N when using an external oscillator as HFXO. Pin setting (explicitly using Pin XXX as NFXTAL_N) is unnecessary, so the default (Pinmode = disable) is fine.
Below is a sample code. The concept is the same for LFXO.
- For sine wave
/* Use external sine wave for HFXO */
CMU->CTRL |= CMU_CTRL_HFXOMODE_BUFEXTCLK;
/* Enable HFXO as high frequency clock, HFCLK */
CMU_ClockSelectSet(cmuClock_HF,cmuSelect_HFXO);
/* Turn off HFRCO if not required */
CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
- Square wave
CMU->CTRL |= CMU_CTRL_HFXOMODE_DIGEXTCLK;
/* Enable HFXO as high frequency clock, HFCLK */
CMU_ClockSelectSet(cmuClock_HF,cmuSelect_HFXO);
/* Turn off HFRCO if not required */
CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
For settings when using an external crystal, see another topic (How should I set the pins when using an external crystal?).
Experienced FAE
Free consultation is available.
From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.