Repository navigation
Description
One request
- This request describes one feature or improvement, or changes that belong to the same feature.
Area
Scope
What do you want to do?
Read the frequency of a slow signal (a few Hz to a few kHz) from the counter overlay and the FC
readout with more than two or three digits.
The hardware counter counts edges over its windows, so its resolution is about one edge per
window, roughly 2 Hz whatever the frequency. That is fine at MHz, but at 50 Hz it gives "50Hz",
at 3 Hz the windows hold zero or one edge and the reading jumps between "no signal", "4.9Hz?" and
"--", and below about 2 Hz it mostly says "no signal" even though the trace clearly shows the
signal. Mains frequency, a slow clock, a tachometer or a 1 PPS output are typical cases where you
want something like 49.987 Hz or 1.00000 Hz.
Proposed solution
A reciprocal counter for CH1: below 5 kHz, TIM2 leaves external-clock (ETR) counting and times
each rising edge with input capture on TI1 instead, so a reading is (edges - 1) / (time between
the first and the last edge) at the timer clock's resolution. Above 20 kHz it goes back to the gate
count. CH2 (TIM4) keeps the gate count, and its windows go on unchanged.
As an option, default Off, so nothing changes unless it is turned on: a row in Analyze > Display >
Frequency counter, "CH1 below 5 kHz", with the choices "Gate" (today's behaviour exactly: TIM2 never
leaves ETR mode and no TIM2 interrupt is attached) and "Timed edges". Theme JSON
plot.counter.timed (0/1): missing reads as 0, written only when 1.
How it behaves in our fork, where it has been used since late November:
- It starts from a Clean gate count under 5 kHz, or from a Changing/Uncertain one under 12 Hz
(that is all the gate can give for a slow signal); it times windows of at least 250 ms. - Edge waits are bounded: a window keeps its last edge as the next window's first, and waits up to
two periods of the last clean rate for the next one (10 s at most, under TIM2's wrap: 11.9 s at 360 MHz). An expected edge that never comes shows "--" and hands back to the gate. - Bursts, chatter and double pulses (shortest gap under 1/8 of the longest) go back to the gate
for a fixed 10 s, marked "?". A signal much faster than the capture should follow (1000 edges
faster than 100 kHz, timed by the edges themselves) trips a guard, disables the interrupt and
does the same with "--". - The TIM2 capture interrupt does only a few loads and stores per edge, and its rate is bounded by
that guard.
Limits: CH1 only (CH2's comparator reaches TIM4 only on its ETR pin, which has no capture channel). The capture filter (N=8 at f_CK_INT)
ignores glitches of a few tens of ns. Holdoffs are not used, so a real double pulse is not timed.
I have this on a branch against 0.21.19 (one commit) and can open it as a PR if you want it. Our
ZT703S tester has had the feature since our test build 44 and reported on it through build 48
(the slow-signal and chatter rules above came out of those reports). Happy to change the row, the
key or the thresholds, or to leave it to you.
Alternatives
The f readout from the record's edges gives more digits for a slow signal, but only over the
screen's time window, and at 3 Hz that means a long timebase. A longer gate window would give more
resolution too, at the cost of a reading every several seconds.
Devices
- ZT703S
- ZT706S
Activity
bve commentedon Nov 26, 2026
Included in the OpenOSC 0.22.0 pre-release.
The Frequency counter menu now offers Timed edges for slow signals on physical CH1. I verified 1 Hz, 3 Hz and roughly 50 Hz on ZT703S, and checked that CH1 returned to gate mode while CH2 continued counting.