PIC32 Oscillator - Oscillator Start-up Timer (OST)

Last modified by Microchip on 2023/11/09 09:01

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":

OST counts 1024 oscillator cycles

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:

The device datasheet should then be consulted to verify the specific features implemented in that device.