PIC32MX Oscillator - Reference Clock

Reference Clock


The Reference clock can be used to drive the SPI peripheral or to generate a clock on the Reference Clock Output pin (REFCLKO).

The reference clock can be derived from any of the following clock sources: System PLL, Primary Osc, Fast RC, Low Power RC, USB PLL output (96 MHz), Secondary Osc, System Clock, Peripheral Bus, Reference Clock input.

Each reference clock has a high-precision divider based on this formula:

  • refOscDiv can be any integer from 1 to 32768
    • When refOscDiv = 0, the output clock = the input clock.
  • trimValue can be any integer from 1 to 512
// ref clock base = FRC
// disable ref clock
PLIB_OSC_ReferenceOscDisable(OSC_ID_0, OSC_REFERENCE_1);
// enable ref clock
PLIB_OSC_ReferenceOscEnable(OSC_ID_0, OSC_REFERENCE_1);
// refOscDiv = 32768
PLIB_OSC_ReferenceOscDivisorValueSet (OSC_ID_0, OSC_REFERENCE_1, 32768);
// trimValue = 256
PLIB_OSC_ReferenceOscTrimSet(OSC_ID_0, OSC_REFERENCE_1, 256);
// ref clock is driven out REFCLKO pin
PLIB_OSC_ReferenceOutputEnable(OSC_ID_0, OSC_REFERENCE_1);

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.