Output Scenario: Period Jitter
Period jitter is the variation in the signal’s period from the ideal
period over time. To measure period jitter, you can measure the period
of many cycles and subtract from the ideal period. With many
measurements, you can calculate statistics, such as minimum, maximum,
and standard deviation. In this scenario, you will generate a signal and
use a logic analyzer to capture the data. You will do this first with
software GPIO, then with TGPIO, and compare jitter values.

Command Example
- Connect software GPIO pin 0 to channel 0 of the logic analyzer. Connect TGPIO pin 0 to channel 2 of the logic analyzer. Connect the ground pin to the ground of the logic analyzer (any channel).The names “software GPIO pin 0” and “TGPIO pin 0” 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_signal.cfg
- In the logic analyzer software, start data capture on channel 0 for 15 seconds.
- Wait until the logic analyzer stops capturing data.
- Stop the sample (Ctrl+C).
- Export the data from the logic analyzer software as1ch_swgpio.csv.
- Run TGPIO mode:
- In the second terminal, run the sample in TGPIO mode:tcc_tgpio_advanced_sample --mode tgpio --signal_file tgpio_signal.cfg
- In the logic analyzer software, start data capture on channel 2 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 as1ch_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 --period --units ms 1ch_swgpio.csv 1ch_tgpio.csv
Output Example
The output shows the minimum or shortest period, the average period, the
maximum or longest period, standard deviation, and jitter (the
difference between the minimum period and the maximum period). For
example:
---- 1ch_swgpio.csv ----
min: 0.458416 ms
avg: 0.500017 ms
max: 0.538310 ms
std: 0.002093 ms
jitter: 0.079894 ms
---- 1ch_tgpio.csv ----
min: 0.500014 ms
avg: 0.500017 ms
max: 0.500020 ms
std: 0.000003 ms
jitter: 0.000006 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. Software GPIO causes higher jitter compared to
TGPIO. Results may vary based on system events, such as interrupts and
scheduler.