3.2.5 Clock (CLK)
This section describes the oscillator, the clocking system and how to configure them. The oscillators, PLLs and clock generators supply clocking to the system, including the CPU and peripherals. The components are configured to work together to produce the required clocks for the system. The following features are covered in this section:
• Clock Generator (CLKGENn)
• PLL Generator (PLLGENn)
• Clock sources including FRC, Primary, BFRC.
• Fail Safe Clock monitor (FSCM)
• REFO Clock
Using The Library
The Clock peripheral library initializes the clock system as configured by the user in the MCC.
Library Interface
Clock Generator peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
CLOCK_Initialize |
Initializes clock system as per MCC configuration |
CLOCK_GeneratorFrequencyGet | Returns clock generator frequency in Hz |
CLOCK_FailStatusGet | Returns clock generator failure status |
CLOCK_MonitorEnable |
Enables clock monitor |
CLOCK_MonitorDisable | Disables clock monitor |
CLOCK_MonitorIsReady | Checks if the clock monitor capture data is ready |
CLOCK_MonitorAccumulatedCountGet |
Returns the accumulated data after the capture |
CLOCK_MonitorMonCallbackRegister | Override default callback and to define custom callback for CLOCK Monitor Saturation event |
CLOCK_MonitorWarnCallbackRegister | Override default callback and to define custom callback for CLOCK Monitor Warning event |
CLOCK_MonitorFailCallbackRegister | Override default callback and to define custom callback for CLOCK Monitor Fail event |
CLOCK_MonitorRdyCallbackRegister | Override default callback and to define custom callback for CLOCK Monitor Data Ready event |
CLOCK_CombinedClockFailCallbackRegister | Override default callback and to define custom callback for CLOCK Combined Clock Fail event |
Data types and constants
Name | Type | Description |
---|---|---|
CLOCK_GENERATOR | Enum | Defines clock generators enabled in the clock plib |
CLOCK_FAIL_STATUS_MASKS | Enum | Defines the fail status mask for each PLL generator and Clock generator |
CLOCK_MONITOR | Enum | Defines clock monitors enabled in the clock plib |
CLOCK_MonitorMonCallback | Typedef | Defines the Clock-Monitor callback function prototype |
CLOCK_CombinedFailCallback | Typedef |
Defines the Clock-Fail callback function prototype |