PIC32MX Oscillator - Primary Oscillator

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

External Clock and Oscillator Modes

External Clock and Oscillator Modes diagram

The Primary Oscillator (POSC) uses the OSC1 and OSC2 pins. POSC can be configured for an External Clock Input (EC mode) or an External Crystal or Resonator (XT or HS mode).

The clock frequencies associated with these modes are device dependent. Please see the specific device datasheet for details.

#pragma config POSCMOD = EC  //default = external clock
#pragma config POSCMOD = HS  //default = high-speed crystal

External Clock Mode with Output Clock

External Clock Mode with Output Clock diagram

When the POSC is in EC mode, the OSC1 pin is a high-impedance input that can be driven by a Complementary Metal Oxide Semiconductor (CMOS) driver.

EC mode also disables the internal feedback buffer allowing the OSC2/CLKO pin to be used for other functions (general-purpose I/O or as a clock-out). The output clock provided on the CLKO pin is the Peripheral Bus Clock (PBCLK).

#pragma config OSCIOFNC = ON  // clock out enabled
#pragma config OSCIOFNC = OFF // clock out disabled