18.2 Clock System Features

The PIC32CM SG00/GC00 clock system features are as follows:

  • Clock sources, that is oscillators controlled by OSCCTRL and OSC32KCTRL:
    • A clock source provides a time base that is used by other components, such as Generic Clock Generators. Example clock sources are the internal 48 MHz DFLL48M, Ultra Low-power 32 kHz RC oscillator, OSCULP32K, PLL and external oscillators XOSC and XOSC32K.
  • Generic Clock Controller (GCLK), which generates, controls and distributes asynchronous clocks consisting of:
    • Generic Clock Generators: These have programmable prescalers that can use any of the system clock sources. The Generic Clock Generator 0 generates the clock signal GCLK_MAIN, which is used by the CPU and Data Ram Tightly Coupled Memory, which in turn generates synchronous clocks.
    • Generic Clocks: These are clock signals generated by Generic Clock Generators. They are the Peripheral Channels and serve as clocks for the peripherals of the system. Multiple instances of a peripheral will typically have a separate Generic Clock.
  • Main Clock Controller (MCLK)
    • The MCLK generates and controls the synchronous clocks for the system. This includes the CPU, bus clocks (AHB (Advanced High-performance Bus), APB (Advanced Peripheral Bus) and AXI (Advanced eXtensible Interface)), as well as the Special Function Register interfaces of the peripherals. It contains clock masks that can turn on/off the user interface of a peripheral as well as prescalers for the CPU and bus clocks.
To customize the clock distribution, refer to these registers and bit fields:
  • The source oscillator for a generic clock generator 'n' is selected by writing to the Source bit field in the Generator Control n, (n=0-15), register (GCLK.GENCTRLn.SRC).
  • A Peripheral Channel m can be configured to use a specific Generic Clock Generator by writing to the Generic Clock Generator bit field in the respective Peripheral Channel m register (GCLK.PCHCTRLm.GEN).
  • The Peripheral Channel number, m, is fixed for a given peripheral. See the Mapping table in the description of GCLK.PCHCTRLm, (i.e., GCLK Chapter).
  • The AHB/APB/AIX Peripheral BUS clocks are enabled and disabled by writing to the respective bit in the AHB/APB/AIX Mask register. The AHB/APB/AIX clocks are enabled and disabled by writing to the respective bit in the AHB/APB/AIX Mask register (MCLK.CLKMSK[0,1,2,3].MSKn). They are enabled by default on reset.