Skip to main content
Skip table of contents

13.2.1 EF Clock Source [T-Series Datasheet]

Overview

The DIO Extended Features (DIO-EF) allow for advanced digital waveform measurement and generation. These features rely on clock sources for timing. The clock sources produce the reference frequencies which are used to generate output waveforms and measure input waveforms. They control output frequency, PWM resolution, maximum measurable period, and measurement resolution.

Clock Sources and Availability

There are three DIO-EF clock sources available, each with specific characteristics and potential conflicts due to shared hardware resources.

Clock Source Specifications

Clock source have different bit sizes. The bit size will limit the maximum value that can be used for RollValue:

  • CLOCK0: 32-bit

  • CLOCK1: 16-bit

  • CLOCK2: 16-bit

Mutual Exclusions

Due to shared hardware resources, certain DIO-EF features and clock sources cannot be used simultaneously. The following table outlines these mutual exclusions:

T4/T7:

  • CLOCK0: Mutual Exclusions: CLOCK1, CLOCK2, High-Speed Counter on CIO0, and High-Speed Counter on CIO1

  • CLOCK1: 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on CIO0

  • CLOCK2: 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on CIO1

T8:

  • CLOCK0: Mutual Exclusions: CLOCK1, CLOCK2, High-Speed Counter on EIO6, High-Speed Counter on EIO7

  • CLOCK1: Mutual Exclusions: CLOCK0, High-Speed Counter on EIO6

  • CLOCK2: Mutual Exclusions: CLOCK0, High-Speed Counter on EIO7

Clock Source Configuration

Each clock source has two key characteristics which need to be configured: Frequency and TickRate. The Frequency of the clock source will be the frequency of output modes and the corresponding period will be the maximum measurable period of input modes. The TickRate sets the smallest step for duty cycle adjustment, and the resolution of measurements. The Frequency and TickRate are configured by specifying the Divisor and RollValue according to the following formulas:

Frequency = CoreFrequency /( Divisor * RollValue )

TickRate = CoreFrequency / Divisor

Period = 1 / Frequency

Resolution = 1 / TickRate

CoreFrequency

The core frequency is device specific, refer to the below list for the proper value:

  • T4: 80 MHz

  • T7: 80 MHz

  • T8: 100 MHz

Divisor

The valid values for DIO_EF_CLOCK#_DIVISOR are 1, 2, 4, 8, 16, 32, 64, or 256, and a value of 0 (default) equates to a divisor of 1.

RollValue

The roll value determines how high the clock will count before starting the count over, also known as a roll. The maximum value varies by which clock source is being used. See the below list for the max value for each clock:

  • Clock0: 4294967295, where 0 = 4294967296

  • Clock1: 65535, where 0 = 65536

  • Clock2: 65535, where 0 = 65536

Clock Source Considerations

This section provides guidelines for optimizing clock source selection and configuration for both input and output modes.

Input Modes

  • Period Measurement: To accurately measure a signal's period, the clock source Period must exceed the maximum period of the signal being measured.

  • Resolution: To achieve maximum measurement resolution, use the smallest possible clock source roll value that accommodates the required measurement period.

Output Modes

  • Frequency: The frequency of output modes, such as Pulse Width Modulation (PWM), is directly determined by the selected clock source frequency.

  • Resolution: The resolution of output modes refers to the smallest adjustable increment of the output signal (e.g., duty cycle in PWM).

Configuration Registers

Tips and Tricks

A clock source can be enabled after DIO#_EF_INDEX has been configured. This allows several DIO-EFs to be started at the same time.

Read

Reading the clock can be useful for generating timestamps. To read the clock, read DIO_EF_CLOCK0_COUNT:

Update

Both the ROLL_VALUE and the DIVISOR can be written while a clock source is running. As long as the clock source's period is greater than 50 µs, the clock will seamlessly switch to the new settings.

Reset

At this time there are no reset operations available for the DIO-EF clock sources.

Examples

Configure CLOCK0 so that a PWM output (index=0) will have a frequency of 10 Hz. ( T4 / T7)

DIO_EF_CLOCK0_ENABLE = 0
DIO_EF_CLOCK0_DIVISOR = 8 # 80 MHz / 8 = 10 MHz
DIO_EF_CLOCK0_ROLL_VALUE = 1000000
DIO_EF_CLOCK0_ENABLE = 1

A frequency input measurement (index=3/4) will be able to count from 0-999999 with each count equal to 0.1 microseconds, and thus a max period of just under 0.1 seconds.

Configure CLOCK0 so that a PWM output (index=0) will have a frequency of 10 Hz. ( T8)

DIO_EF_CLOCK0_ENABLE = 0

DIO_EF_CLOCK0_DIVISOR = 16 # 100 MHz / 16 = 6.25 MHz

DIO_EF_CLOCK0_ROLL_VALUE = 625000

DIO_EF_CLOCK0_ENABLE = 1

A frequency input measurement (index=3/4) will be able to count from 0-624999 with each count equal to 0.16 microseconds, and thus a max period of just under 0.1 seconds.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.