Phil Pilgrim (PhiPi)
06-05-2010, 02:23 PM
The Propeller's NCO and PLL counter output modes suffer phase jitter under certain circumstances, namely when there are a lot of "1" bits after the highest-order "1" bit in FRQx. The jitter can be remedied by adding an external PLL. This will help, even with the counters' PLL mode, if the external PLL has a longer time constant than that of the Propeller's built-in PLLs. To test this, I used the following short program to generate a jittery counter output:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PUB start
frqa := $f77_7777
ctra := %00100 << 26 | 0
dira := 1
repeat
The output frequency was around 5 MHz with pronounced phase jitter. I ran this signal through the following circuit, which is a phase-locked loop* with an extremely long time constant (i.e. not one you'd want to use for frequency modulation):
http://forums.parallax.com/attachment.php?attachmentid=70867
The result was a square wave clock of the same average frequency, but without the phase jitter. To quantify the improvement, I ran each signal through my scope's FFT analyzer, saving the raw input as a reference, and displaying the PLL'd spectrum below it:
http://forums.parallax.com/attachment.php?attachmentid=70868
Clearly visible in both spectra are the fundamental and some odd harmonics, as would be expected from a square wave. But the straight counter output has a lot of small peaks nestled amongst the expected harmonics, which is caused by the phase jitter. The PLL output has none of that.
I haven't tried shortening the PLL time constant to see where the jitter starts to show up. This was more just a proof of principle to see if the external PLL would help. And it did.
-Phil
* The 74LV4046 is just a much speedier cousin to the venerable CD4046.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PUB start
frqa := $f77_7777
ctra := %00100 << 26 | 0
dira := 1
repeat
The output frequency was around 5 MHz with pronounced phase jitter. I ran this signal through the following circuit, which is a phase-locked loop* with an extremely long time constant (i.e. not one you'd want to use for frequency modulation):
http://forums.parallax.com/attachment.php?attachmentid=70867
The result was a square wave clock of the same average frequency, but without the phase jitter. To quantify the improvement, I ran each signal through my scope's FFT analyzer, saving the raw input as a reference, and displaying the PLL'd spectrum below it:
http://forums.parallax.com/attachment.php?attachmentid=70868
Clearly visible in both spectra are the fundamental and some odd harmonics, as would be expected from a square wave. But the straight counter output has a lot of small peaks nestled amongst the expected harmonics, which is caused by the phase jitter. The PLL output has none of that.
I haven't tried shortening the PLL time constant to see where the jitter starts to show up. This was more just a proof of principle to see if the external PLL would help. And it did.
-Phil
* The 74LV4046 is just a much speedier cousin to the venerable CD4046.