void setup() {
pinMode(31, OUTPUT);
digitalWrite(31, LOW);
}
int v=0;
void loop() {
v = v ? LOW : HIGH;
digitalWrite(31, v);
}
Trigger holdoff creates a minimal delay between the last and subsequent trigger events. Increasing this value we can eliminate the jitter, but the method is sensitive. Go just a little too far and the jitter will reappear. In this case, the range of working holdoff values is 36.12us - 34.94us = 1.18us.
Based on waveform period, the ideal holdoff should be around 8.8us, but the working holdoff was four times this. Occasionally there was a 1.1us delay in the call to loop(), shown by the following two captures. This delay was visible in every 12th consecutive capture.
Another cleanup method is to trigger on pulse width. In this case, the trigger is fired when the base is greater than 4.36us, any sooner and the jitter reappears, longer than 5.65us and trigger fails. But this is shorter than what we would expect given the waveform period. Also, the waveform becomes noticeably dimmer, because there are fewer traces. The trigger is occurring during the extended low period between calls to loop(), and it shows in the extended capture time for the same number of waveforms.
Another option may be to average the captured waveforms. But with a larger number of averaged captures, this could easily be misleading as a stable signal. May be best to leave the number of averages low and remain aware of the jitter.
Being overly aggressive with trigger jitter removal could mask important aspects of the signal. But thankfully, at least with oscilloscopes, they still let the human override automatic settings, and make better choices when needed.
Typical of EEVblog, they have an excellent video on three methods to reduce trigger jitter: trigger holdoff, pulse width trigger, and external trigger.