3.2 Clock Driver

3.2.1 Introduction

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.

3.2.2 Module Documentation

3.2.2.1 Clock Driver

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

3.2.2.1.1 Module description

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

3.2.2.1.1.1 Definitions

3.2.2.1.2 Definition Documentation

3.2.2.1.2.1 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.

3.2.2.1.2.2 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.

3.2.2.1.2.3 CLOCK_SystemFrequencyGet

#define CLOCK_SystemFrequencyGet( ) (8000000UL)

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

3.2.2.1.3 Function Documentation

3.2.2.1.3.1 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

3.2.2.1.3.2 CLOCK_Initialize()

void CLOCK_Initialize (void )

Initializes all the INTERNAL OSCILLATOR sources and clock switch configurations.

Parameters:
none
Returns:

none

3.2.3 File Documentation

3.2.3.1 source/clock.h File Reference

#include <stdbool.h>

3.2.3.1.2 Macros

3.2.3.1.3 Detailed Description

CLOCK Generated Driver Header File