Skip to main content
Skip table of contents

13.2.1 EF Clock Source [T-Series Datasheet]

Overview

The clock source settings produce the reference frequencies used to generate output waveforms and measure input waveforms. They control output frequency, PWM resolution, maximum measurable period, and measurement resolution. In general, a slower Clock#Frequency will increase the maximum measurable period, and a faster Clock#Frequency will increase measurement resolution.

Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR    // typically 80M/Divisor


DIO_EF core frequency varies by device.

DeviceDIO_EF Core Frequency
T480 MHz
T780 MHz
T8100 MHz

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.

There are 3 DIO-EF clock sources available. Each clock source has an associated bit size and several mutual exclusions. Mutual exclusions exist because the clock sources share hardware with other features. A clock source is created from a hardware counter. CLOCK1 uses COUNTER_A (CIO0) and CLOCK2 uses COUNTER_B (CIO1). The 32-bit clock source (CLOCK0) is created by combining the 2 16-bit clock sources (CLOCK1 CLOCK2). The following list provides clock source bit sizes and mutual exclusions:

T4/T7:

  • CLOCK0: 32-bit. Mutual Exclusions: CLOCK1, CLOCK2, High-Speed Counter on CIO0, 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: 32-bit. Mutual Exclusions: CLOCK1, CLOCK2, High-Speed Counter on EIO6, High-Speed Counter on EIO7
  • CLOCK1: 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on EIO6
  • CLOCK2: 16-bit. Mutual Exclusions: CLOCK0, High-Speed Counter on EIO7

The clock source is not a DIO-EF feature, but the four basic operations of Configure, Read, Update, and Reset still apply.

Configure

There are four registers associated with the configuration of clock sources:

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.

DIO_EF_CLOCK0_ROLL_VALUE is a 32-bit value (0-4294967295) if using a 32-bit clock, and a 16-bit value (0-65535) if using a 16-bit clock. 0 results in the max roll value possible (232 for 32-bit clocks, 216 for 16-bit clocks).

Read

To read the clock, read DIO_EF_CLOCK0_COUNT:

This can be useful for generating timestamps.

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.

Example

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.

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.