[sdiy] Digital oscillator problem

Seb Francis seb at burnit.co.uk
Mon Nov 17 15:58:31 CET 2008

Tom Wiltshire wrote:
> The problem is noise coming in on the ADC channels. I then compound 
> this problem by using those CVs in the most important parts of my 
> algorithm, like the frequency increment calculation, and the FM maths. 
> The FM maths is particularly bad since it multiplies the output of one 
> oscillator up by a factor of four (increasing the jitter/noise by the 
> same amount) to increase the FM depth. The FM waveforms look great, 
> except you can see the noise on the scope and hear it too.
> I've thought about trying to apply some digital filtering to the CV 
> inputs, but I'm not sure how that would work. The ADC is running using 
> a DMA channel in the background, so I don't know exactly how often it 
> samples. My oscillators are producing samples at 50KHz.
> The whole thing is currently lying on a breadboard on my bench, so 
> it's probably as bad as it can be right now. Hopefully the problem 
> would be less severe on a decent PCB. But if it weren't, what would 
> you recommend?

Hi Tom,

It probably doesn't help that you have it on a breadboard as these 
dsPICs are noise things.  My tips ...

Use a clean supply for AVDD and AGND.  Try a low pass filter on the way 
in to the AD pin (a small resistor, following by capacitor to AGND).  
Make sure you keep the resistor small (check the specs for the max 
source impendance and keep well under it).

Not sure if the analog LP filter will help enough but since you have it 
on a breadboard you may as well try.

Software wise, use a fairly long sample window.  If it's still too noisy 
(quite likely that it will be) then you'll need to use some digital 
filtering.  A short FIR filter will do the trick.  I used one in the 4xD 
code when running in half-sample rate mode to filter the input from the 
CODEC (you get nasty HF distortion if you just discard every other 
sample, or average each pair).  Will need to be a constant sample rate 
for the filter to work properly.

The source code is here:

Search main.s for "FIR".  The FIR response is defined in fir.dsinc  I 
used software called ScopeFIR to create the filter I needed.


More information about the Synth-diy mailing list