Output Scenario: Two-Signal Synchronization
In this scenario, you will generate two simultaneous signals with same
period and different phase. You will capture the signals with a logic
analyzer and calculate the phase shift for every cycle. Calculated
statistics (minimum, maximum, average, standard deviation, and jitter)
will demonstrate how precisely the signals can be synchronized. You will
do this first with software GPIO, then with TGPIO, and compare jitter
values.

Command Example
- Connect software GPIO pin 0 to the logic analyzer channel 0. Connect software GPIO pin 1 to the logic analyzer channel 1. Connect TGPIO pin 0 to the logic analyzer channel 2. Connect TGPIO pin 1 to the logic analyzer channel 3. Connect the ground pin to the ground of the logic analyzer (any channel).The names “software GPIO pin 0/1” and “TGPIO pin 0/1” are placeholders. For information about pins specific to your hardware, see Example Pins.
- Open two terminal windows.
- In the first terminal, run stress-ng:stress-ng -t0 -C 0 -c 0 --taskset 2 --aggressive
- Run software GPIO mode:
- In the second terminal, go to the following directory:cd /usr/share/tcc_tools/samples/tcc_tgpio_samples/tcc_tgpio_advanced_sample/cfg/<BOARD>Where<BOARD>matches your current platform.
- Run the sample in software GPIO mode:tcc_tgpio_advanced_sample --mode soft --signal_file soft_two_signals.cfg
- In the logic analyzer software, start data capture on channels 0 and 1 for 15 seconds.
- Wait until the logic analyzer stops capturing data.
- Stop the sample (Ctrl+C).
- Export the data from the logic analyzer software as2ch_swgpio.csv.
- Run TGPIO mode:
- In the second terminal, run the sample in TGPIO mode:tcc_tgpio_advanced_sample --mode tgpio --signal_file tgpio_two_signals.cfg
- In the logic analyzer software, start data capture on channels 2 and 3 for 15 seconds.
- Wait until the logic analyzer stops capturing data.
- Stop the sample and stop stress-ng (Ctrl+C).
- Export the data from the logic analyzer software as2ch_tgpio.csv.
- Analyze the captured data with the provided script:
- Go to the script directory:cd ${TCC_ROOT}/samples/plot_scripts
- Copy the CSV files from the previous steps to this directory.
- Run the script to analyze results:./tcc_signal_analyzer_plotter.py --shift --units ms 2ch_swgpio.csv 2ch_tgpio.csv
Output Example
The output shows the minimum or shortest phase shift, the average phase
shift, the maximum or longest phase shift, standard deviation, and
jitter (the difference between the minimum phase shift and maximum phase
shift). For example:
---- 2ch_swgpio.csv ----
min: 0.249245 ms
avg: 0.249747 ms
max: 0.254427 ms
std: 0.000446 ms
jitter: 0.005182 ms
---- 2ch_tgpio.csv ----
min: 0.250010 ms
avg: 0.250011 ms
max: 0.250012 ms
std: 0.000001 ms
jitter: 0.000002 ms
The script generates a plot, which appears in a separate window. For
example:

In this example, software GPIO data is represented in blue. TGPIO data
is represented in orange. TGPIO has lower jitter compared to software
GPIO.