[time-nuts] Re: shoestring budget & jitter AVR328p

Andrew Rodland andrew at cleverdomain.org
Tue Oct 31 16:15:52 UTC 2023


Phase noise causes spectral broadening and spurs — if you were to have your
synthesizer produce a 500Hz sine wave from a 4MHz clock, but the 4MHz clock
has ticks that aren't all 250ns long, then instead of getting a pure tone
on the output you would get something that "spreads out" to the frequencies
on either side of 500Hz, possibly with some sharp peaks some distance away.

But this doesn't really matter for what you're doing.

The way you're programming the timer on the 328 is just an integer divider
coming straight down from the CPU's clock. Every n clock cycles, the output
is told to flip-flop. If you had fractional division (intentionally
alternating between timer periods to get a more accurate long-term
frequency) that would cause spurs. If you were dividing down some *faster*
clock but then *sampling* it at the 328's clock rate, that would cause
issues. But what you're doing is basically too simple to go wrong, and the
only noise on the output frequency should be what comes from the input.

That input, on an Arduino Nano, is an Abracon crystal oscillator, which is
nothing special by time-nuts standards, but probably as good or better than
the clock sources in any of the devices where the SAA1099 originally lived.

Probably your biggest contributor will be ADC noise. Try this if you can:
program the SAA to output the cleanest tone you can, and then very very
slowly adjust the pot near the bottom of its range to the point where it
jumps between two discrete frequencies. If you get things just right, you
might get a sort of raspy two-tone output. That would be because successive
analogRead()s are producing different values, causing your timer tick
interval to rapidly and randomly alternate between 1 and 2 clocks. That's
artificially induced jitter. Of course you can also do it at the point
between 2 and 3, between 3 and 4, etc., but that lowest one should be the
most notable.

Andrew



On Wed, Oct 18, 2023 at 6:11 AM folkert via time-nuts <
time-nuts at lists.febo.com> wrote:

> Hello,
>
> As an electronic music-enthousiast I also tinker with sound-chips of
> the 8- and 16-bit age. Circuit bending for example. And about that I
> have a question.
> On my website I published a page describing in a nutshell how tweaking
> the clock-frequency of a Philips SAA-1099p soundchip gives interesting
> sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
> a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
> soundchip.
> A friend of mine read this and asked me if I have any ideas about the
> jitter introduced. Like: if I set the clock to 4MHz, how much jitter
> would this give. Now I read somewhere that delays of less than 5ms are
> usually not audible but does that also apply to jitter?
> First step in the investigation of that is to quantify how much the
> jitter introduced is (I guess). I know that when you have a PPS
> signal, that you can easily feed that to code that calculates the allan
> deviation, but how about clocks in the MHz range? If I divide the clock,
> wouldn't that average out any jitter?
> My budget is limited and/but I (do) have a hantek DSO-6022BL
> oscilloscope, some PicDivs and a 10MHz TCXO.
>
>
> Regards,
>
> Folkert.
> _______________________________________________
> time-nuts mailing list -- time-nuts at lists.febo.com
> To unsubscribe send an email to time-nuts-leave at lists.febo.com
>





More information about the Time-nuts_lists.febo.com mailing list