Oscillator Start-up Timer
Crystal oscillators require some time to generate a stable output. The Oscillator Start-up Timer (OST) is automatically applied any time you want to use or switch to a clock source that was disabled and that uses a crystal or ceramic resonator.
If you are using the PLL, an additional delay is required to allow the PLL to achieve lock. Click on the following links for for more information on the "System PLL Lock Status":
PIC32MX System PLL Lock Status
PIC32MZ System PLL Lock Status
The OST is a simple 10-bit counter that counts 1024 oscillator cycles before releasing the oscillator clock to the rest of the system. The amplitude of the oscillator signal must reach the VIL and VIH thresholds before the OST can begin to count cycles.
When enabled, the OST is used every time the oscillator has to restart (i.e., on a Power-on Reset (POR), Brown-out Reset (BOR) or a wake-up from Sleep mode). The Primary and Secondary oscillators (POSC and SOSC) both have their own OST.
The Secondary oscillator can be enabled or disabled at run-time using the following MPLAB® Harmony functions:
- PLIB_OSC_SecondaryEnable(OSC_ID_0); // enable Secondary oscillator
- PLIB_OSC_SecondaryDisable(OSC_ID_0); // disable Secondary oscillator
Reasons you may want to keep the Secondary oscillator running at all times:
- Enable a fast switch to the 32 kHz system clock for lower power operation
- Allow the Real-Time Clock to keep time during Sleep mode
- Allow Timer1 to keep counting during Sleep mode
Detailed Overview
For more detail on the Oscillator Start-up Timer feature for a specific PIC32 device, please view the Oscillator family reference manual chapter for that device, for example:
- Section 6. Oscillators (PIC32MX795F512L)
- Section 42. Oscillators with Enhanced PLL (PIC32MZ2048EFG100)
The device data sheet should then be consulted to verify the specific features implemented in that device.