How to Achieve 0.1 Hz Resolution from 0 to 10 kHz Using STM32 Timer?
Hi everyone,
I'm trying to generate output frequencies from 0 Hz to 10,000 Hz using STM32F407VET6 with Timer2 in Output Compare Toggle Mode. The timer clock is 84 MHz.
I need to achieve:
0.1 Hz resolution up to 10 kHz
Ideally, also support 0.001 Hz resolution at lower frequencies
The problem is that at higher frequencies, the formula:
But since ARR must be an integer, I have to use 4200, which gives 10,000 Hz — a 0.1 Hz error.
i am using DDS (Direct Digital Synthesis) using a phase accumulator in software
With DDS, I can theoretically achieve very fine resolution, but when I measure the output using a CRO (oscilloscope), I notice jitter in the waveform.
Question:
How can I generate accurate frequencies with 0.1 Hz resolution across the full range (up to 10 kHz)?
Are there any techniques (e.g., fractional timers, clock tricks, advanced modes, combining timers) to overcome this limitation?
