Command-Line Options
Sample
Running the advanced TGPIO sample with the
-h
option yields the following usage message:Usage:
tcc_tgpio_advanced_sample --mode <mode> --signal_file <path>
Argument | Description |
---|---|
-m, --mode <mode> | Specify the mode (soft or tgpio) to run. |
-c, --signal_file <path> | Specify the path to the signal config file. |
The software GPIO signal file has the following parameters:
- pin: Index of the output pin
- offset: Offset since start_time, in nanoseconds
- period: Output period for this pin, in nanoseconds
Signal file format:
<pin> <offset, ns> <period, ns>
<pin> <offset, ns> <period, ns>
Example: To generate two square waves with a period of 1 µs and a
0.25-µs phase shift on pins gpio175 and gpio171:
175 0 1000000
171 250000 1000000
The TGPIO signal file has the following parameters:
- pin: Index of the output pin
- offset: Offset since start_time, nanoseconds
- period: Output period for this pin, nanoseconds
- channel: Indicates the channel assigned to this pin. Channels are used for compatibility with other PTP devices. For TGPIO devices, the channel must be equal to the pin index.
- device: Path to the TGPIO PTP device
Signal file format:
<pin> <offset> <period> <channel> <device>
<pin> <offset> <period> <channel> <device>
Example: To generate two square waves with a period of 1 µs and a
0.25-µs phase shift on pins 0 and 1 from device
/dev/ptp0
:0 0 1000000 0 /dev/ptp0
1 250000 1000000 1 /dev/ptp0
Analyzer Script
Running the analyzer script with the
-h
option yields the following usage message:usage: tcc_signal_analyzer_plotter.py [-h] (--period | --shift) [--output OUTPUT]
[--min MIN] [--max MAX] [--units {s,ms,us,ns}]
log_file [log_file ...]
Argument | Description |
---|---|
-h, --help | Show this help message and exit |
--period | Plot the periodic signal |
--shift | Plot the phase difference between two signals |
--output OUTPUT | Output file; otherwise, display in window |
--min MIN | Minimum plotting boundary |
--max MAX | Maximum plotting boundary |
--units {s,ms,us,ns} | Time units to display (default: nanosecond) |
log_file | Signal file captured with logic analyzer, oscilloscope, etc. |
File Format
The format of the export file may vary by logic analyzer hardware and software. The Saleae* Logic 1.2.x software was used in this sample.
tcc_signal_analyzer_plotter.py
works with comma-separated CSV files.
The first column is a timestamp of each edge, in seconds. The following columns are the edges of
channels 0, 1, etc., respectively. A rising edge is 1; a falling edge is 0. The file has one row per channel change.Example file with one channel:
Time[s], Channel 0
0.000000000000000, 0
1.017330524000000, 1
2.131018628000000, 0
2.131057090000000, 1
2.131095558000000, 0
...