5.2.3 CLKCTRL with Clock Failure Detection

Clock Controller with Auto-tuning and Clock Failure Detection

5.2.3.1 Introduction

The CLKCTRL controls, distributes and prescales the clock signals from the available oscillators. The CLKCTRL supports internal and external clock sources. This CLKCTRL module has an auto-tune feature that can be used to improve the accuracy of the internal oscillator. In addition, it also has Clock Failure Detection (CFD) that allows the device to continue operating if an external crystal oscillator or clock source should fail.

5.2.3.2 Supported Device Families

AVR® DBAVR® DDAVR® Ex

5.2.3.3 Required header files:

#include "mcc_generated_files/system/clock.h"

5.2.3.4 Module Documentation

5.2.3.4.1 CLKCTRL

This header file provides APIs for the CLKCTRL driver.

Module description

This header file provides APIs for the CLKCTRL driver.

Version: CLKCTRL Driver Version 1.0.2
Functions
  • void CLOCK_Initialize (void)

    Initializes the CLKCTRL module.

  • void CFD_Enable (CLKCTRL_CFDSRC_t cfd_source)

    Enables the Clock Failure Detection on the main clock.

  • void CFD_Disable ()

    Disables the Clock Failure Detection on the main clock.

Function Documentation

CFD_Disable()

void CFD_Disable ( )

Disables the Clock Failure Detection on the main clock.

Parameters:
None.
Returns:

None.

CFD_Enable()

void CFD_Enable (CLKCTRL_CFDSRC_t cfd_source)

Enables the Clock Failure Detection on the main clock.

Parameters:
CLKCTRL_CFDSRC_t

cfd_source - main clock source for CFD

Returns:

None.

CLOCK_Initialize()

void CLOCK_Initialize (void )

Initializes the CLKCTRL module.

Parameters:
None.
Returns:

None.

5.2.3.5 File Documentation

5.2.3.5.1 source/clock.c File Reference

#include "../clock.h"

Functions

  • void CLOCK_Initialize (void)

    Initializes the CLKCTRL module.

  • void CFD_Enable (CLKCTRL_CFDSRC_t cfd_source)

    Enables the Clock Failure Detection on the main clock.

  • void CFD_Disable ()

    Disables the Clock Failure Detection on the main clock.

5.2.3.5.2 source/clock.h File Reference

#include "ccp.h"

Functions

  • void CLOCK_Initialize (void)

    Initializes the CLKCTRL module.

  • void CFD_Enable (CLKCTRL_CFDSRC_t cfd_source)

    Enables the Clock Failure Detection on the main clock.

  • void CFD_Disable ()

    Disables the Clock Failure Detection on the main clock.

Macro Definition Documentation

CLKCTRL_TIMEBASE_VALUE

#define CLKCTRL_TIMEBASE_VALUE ((uint8_t)ceil(F_CPU * 0.000001))

F_CPU

#define F_CPU 4000000UL