[sdiy] MIDI Clock sync advice

mskala at northcoastsynthesis.com mskala at northcoastsynthesis.com
Sat Mar 9 18:55:46 CET 2024

On Fri, 8 Mar 2024, brianw wrote:

> You're definitely on the right track. It's possible that you'll get stuck
> between a rock and a hard place, where a 16-bit timer can't possibly have
> both enough resolution and enough range.
> One possible solution is that some chips allow a pair of 16-bit
> timer/counter peripherals to be combined into a single 32-bit timer/counter.

This is what's done in my Gracious Host design.  A 32-bit hardware counter
counting at 2MHz keeps track of the time within a 24-ppqn clock pulse, and
a software counter keeps track of which pulse we're on within the quarter
note.  Code description is on pages 96-97 of the programmers' manual:

The general 1kHz heartbeat of the USB interface may result in some jitter
of individual pulses/notes, but the longer-term accuracy should be that of
the 32-bit timer, that is, 500ns for the pulses and 24 times that or 12us
for the quarter notes.

Matthew Skala
North Coast Synthesis Ltd.

More information about the Synth-diy mailing list