2.29.2 Clock Driver

Overview

The Clock Driver helps the user to easily configure the System Clock , Auxiliary Clock , Reference Clock and CAN FD Clock.

Features

System Clock

  • User configurable System clock source.
  • User configurable input frequency depending on the configured clock source.
  • Auto configuration of System clocks(FOSC, FOSC/2) just by providing the required system frequency(FOSC) in Hertz.

Auxiliary Clock

  • User configurable Auxiliary clock source.
  • Auto configuration of Auxiliary clock just by providing the required auxiliary clock output frequency in Hertz.

Reference Clock

  • User configurable Reference clock source.
  • Auto configuration of Reference clock just by providing the required REFO frequency in Hertz.

CAN FD Clock

  • User configurable CAN FD clock source.
  • Selected clock source is applicable for all CAN FD instances
  • Requested FCAN frequency can be configured from CAN 2.0/CAN-FD modules in Drivers category.

2.29.2.1 Module Documentation

2.29.2.1.1 Clock Driver

Clock configurator driver for System and Peripheral Clock using dsPIC MCUs.

Module description

Clock configurator driver for System and Peripheral Clock using dsPIC MCUs.

Definitions

Definition Documentation

CLOCK_InstructionFrequencyGet

#define CLOCK_InstructionFrequencyGet( ) ((uint32_t)CLOCK_SystemFrequencyGet() / (uint32_t)2)

This macro is used to read the Instruction Clock (FCY) Frequency configured in the MCC Melody User Interface.

CLOCK_PeripheralFrequencyGet

#define CLOCK_PeripheralFrequencyGet( ) ((uint32_t)CLOCK_SystemFrequencyGet() / (uint32_t)2)

This macro is used to read the Peripheral Clock (FP) Frequency configured in the MCC Melody User Interface.

CLOCK_SystemFrequencyGet

#define CLOCK_SystemFrequencyGet( ) (8000000UL)

This macro is used to read the System clock (FOSC) Frequency configured in the MCC Melody User Interface.

Function Documentation

CLOCK_AuxPllLockStatusGet()

bool CLOCK_AuxPllLockStatusGet (void )

Returns Auxiliary PLL status.

Precondition:

CLOCK_Initialize() should be called for the associated function to work.

Parameters:
none
Returns:

true - Auxiliary PLL locked

false - Auxiliary PLL not locked

CLOCK_Initialize()

void CLOCK_Initialize (void )

Initializes all the INTERNAL OSCILLATOR sources and clock switch configurations.

Parameters:
none
Returns:

none

2.29.2.2 File Documentation

2.29.2.2.1 source/clock.h File Reference

#include <stdbool.h>

Macros

Detailed Description

CLOCK Generated Driver Header File