« Close

Datasheets and User Guides

App Notes

Software & Driver

 

13.2.7 Line-to-Line In [T-Series Datasheet]

Overview

 

T4 Capable DIO: DIO4, DIO5 (aka FIO4, FIO5)

 

T7 Capable DIO: DIO0, DIO1 (aka FIO0, FIO1)

Requires Clock Source: Yes

Index: 6

Streamable: No

Operation

Line-to-Line In measures the time between an edge on one DIO line and an edge on another DIO line by counting the number of clock source ticks between the two edges.  The edges can be individually specified as rising or falling.

Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR    //typically 80M/Divisor
Time(s) = DIO#_EF_READ_A / Clock#Frequency
Resolution(s) = 1 / Clock#Frequency
Max Time(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency

CoreFrequency is always 80 MHz at this time, but in the future some low-power operational modes might result in different core frequencies.  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.  For more details about Clock#Frequency and DIO_EF_CLOCK#_DIVISOR, see the DIO-EF Clock Source section.

Roll value for this feature would typically be left at the default of 0, which is the max value (2^32 for the 32-bit Clock0), but you might be using a lower roll value for another feature such as PWM Out.

A couple typical scenarios with roll value = 0 and using the 32-bit clock (Clock0):

  • Divisor = 1, Resolution = 12.5 nanoseconds, MaxPeriod = 53.7 seconds
  • Divisor = 256, Resolution = 3.2 microseconds, MaxPeriod = 229 minutes

Line-to-Line In operates in a one-shot mode. Once the specified combination of edges is observed, the data is saved and measuring stops. Another measurement can be started by resetting or performing the configuration procedure again.

Configure

Configuring Line-to-Line In requires configuring two digital I/O lines (DIO0 and DIO1 only) as Line-to-Line In feature index 6. The first DIO configured should be the one expecting the first edge. Any extended features on either DIO should be disabled before beginning configuration.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable
DIO#_EF_INDEX: 6
DIO#_EF_OPTIONS: Bits 0-2 specify which clock source to use ... 000 for Clock0, 001 for Clock1, and 010 for Clock2. All other bits are reserved and should be set to 0.
DIO#_EF_CONFIG_A: 0 = falling edge. 1 = rising edge.
DIO#_EF_CONFIG_B: Not used.
DIO#_EF_CONFIG_C: Not used.
DIO#_EF_CONFIG_D: Not used.

Update

No update operations can be performed on Line-to-Line In.

Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the one-shot measured time in clock source ticks.  If the specified combination of edges has not yet been observed this value will be zero.  DIO0 & DIO1 both return the same value.
DIO#_EF_READ_A_F: Returns the time in seconds.

Reset

DIO#_EF_READ_A_AND_RESET: Performs the same operation as DIO#_EF_READ_A, then clears the result and starts another measurement.

Example

First, configure the clock source:

DIO_EF_CLOCK0_DIVISOR = 1     // Clock0Frequency = 80M/1 = 80 MHz
DIO_EF_CLOCK0_ROLL_VALUE = 0
DIO_EF_CLOCK0_ENABLE = 1

This clock configuration results in:

Resolution = 1 / 80M = 12.5 ns

and

MaxPeriod = 2^32 / 80M = 53.7 seconds

Now configure the DIO-EF on DIO0 and DIO1 as line-to-line:

DIO0_EF_ENABLE = 0
DIO1_EF_ENABLE = 0

DIO0_EF_INDEX = 6     // Index for line-to-line feature.
DIO0_EF_OPTIONS = 0   // Select the clock source.
DIO0_EF_CONFIG_A = 0  // Detect falling edge.
DIO0_EF_ENABLE = 1    // Turn on the DIO-EF

DIO1_EF_INDEX = 6     // Index for line-to-line feature.
DIO1_EF_OPTIONS = 0   // Select the clock source.
DIO1_EF_CONFIG_A = 0  // Detect falling edge.
DIO1_EF_ENABLE = 1    // Turn on the DIO-EF

At this point the device is watching DIO0 for a falling edge.  Once that happens it watches for a falling edge on DIO1.  Once that happens it stores the time between those 2 edges, which you can read from the READ registers described above.

To do another measurement, repeat the DIO0-EF configuration above, or read from DIO0_EF_READ_A_AND_RESET.