Cushychicken / bfunc

Open Source, Breadboard-Friendly Function Generator Design
38 stars 4 forks source link

Waveform out of sync over 2.3mhz. #1

Open whinis opened 4 years ago

whinis commented 4 years ago

Once the frequency goes above 2.3mhz or there about the signal appear to lose sync for all wave forms. The frequency appears to be close to the set value up to 5mhz but it fails to stay consistent. Below are 2 captures from my oscilloscope of a Square wave and Sine wave both at 3mhz NewFile7 NewFile8

Cushychicken commented 4 years ago

@whinis have you tried increasing the vertical scale of your oscilloscope? I noticed a similar problem with my Rigol not triggering properly at lower amplitudes. Increasing the vertical signal scale resolved that.

I see an issue with the sine wave, but a different one - at 2.3MHz (and to a lesser extent at 1MHz) you're seeing extra harmonic junk from the DDS DAC. Instead of being a nice smooth sine wave, you get a bunch of nasty capacitive transitions. Will need to design a filter for the next board rev to improve this.

I see the issue you describe with the square wave. That's junk. Need to dig into that.

whinis commented 4 years ago

Yes, I have attempted to increase the vertical scale and see the same stuff. Its likely the harmonics and them switching forms back and forth that's causing this issue because as you can sort of see there is 3 nodes in the sine wave.

whinis commented 4 years ago

Here is an update. I tried it with both a 100nf capacitor as suggested in the datasheet as well as 100pf. the 100pf helped a bit but there is other errors happening. Here it is now at 5mhz, both an average as well as single shot. The 100nf turned the square into a triangle and ruined both sine and triangle waves. NewFile9 NewFile10

Cushychicken commented 4 years ago

Interesting. Just to confirm - you're placing this capacitor at the output, from the VOUT pin to AGND? I haven't seen any references to needing a 100nF cap at the VOUT pin in the datasheet. There is the test circuit suggestion of adding 20pF at the output pin on page 9 of the datasheet:

Screenshot 2020-04-09 08 09 42

This is also consistent with the AD9834, which suggests including a 20pF cap at the current output of that chip to help reduce clock feedthru. (The AD9837 integrates a 200 ohm termination resistor onto the die - these are external components required by the AD9834.)

In any case - what I think we're seeing here is harmonic overtones as a result of operating closer to the DDS chip's oscillator frequency. The on-board oscillator is running at 16MHz - it's definitely not going to do anything close to sinusoidal reconstruction as you get closer to 8MHz.

A higher order filter design is needed, and that's probably not something we'll be able to add to this PCB. Might be a good job for a separate filter PCB, though. I've linked this circuit note from Analog Devices on the AD9834, which is a part in the same family as the AD9837, which includes a little design brief for a 7th order elliptic lowpass filter at the output of the generator. You can see the spectrum plots on page 3 that shows the difference in harmonic content between the raw IOUT terminated output (equivalent to VOUT in our case) and the harmonic content at the output of the elliptic filter.

https://www.analog.com/media/en/reference-design-documentation/reference-designs/CN0304.pdf

whinis commented 4 years ago

So, I found that cap advice on their evaluation board at https://www.analog.com/media/en/technical-documentation/user-guides/UG-269.pdf firefox_2020-04-09_08-33-06 firefox_2020-04-09_08-33-37

However yes, this is a 0603 cap sitting between the VOUT and AGND pins directly on the other side of the board from the BNC. its the perfect distance for a 0603

Cushychicken commented 4 years ago

Hm. I wonder if that was a placeholder footprint. (200Ω || 100nF) yields a -3dB frequency of about 8kHz.

whinis commented 4 years ago

If the picture on their website is correct you may be onto something as that pad looks unpopulated on the image. EvalBoard

Cushychicken commented 4 years ago

@whinis have you ever tried your hand at filter design before? I plugged in the parameters for a 7th order elliptic lowpass filter into the rf-tools filter calculator website and got this result:

image

I don't have any of the components for this on hand - wondering if you happen to have any of the required inductor or cap values.

whinis commented 4 years ago

I don't have the inductors on hand but every everything else. Also need to wait until the end of the month to order anything else.

Cushychicken commented 4 years ago

Some good app notes on jitter/sync issues for output. Sounds like a filter will help.

https://www.analog.com/media/en/technical-documentation/application-notes/351016224AN_837.pdf?doc=AD9834.pdf

https://www.analog.com/media/en/technical-documentation/application-notes/475354741144165304775709740692131461831AN823_0.pdf

whinis commented 4 years ago

Alright I finally got parts in and have an update. For the square wave latest that filter really helps and allows for an ultra clean square wave up to about 4 mhz( tested from around 10k-5mhz). After 4 mhz I seem to get some extreme issues on the wave form and I end up getting only half the designate frequency with lots of harmonics.

Cushychicken commented 4 years ago

Cool! Can you post a picture of the waveform with the harmonics?

There are some tradeoffs of elliptic filters and funky group delay is one of them. Might have to modify topology slightly to a Bessel filter which is not a huge reorganization from elliptic.

whinis commented 4 years ago

Square wave at 4 mhz NewFile1 Square wave at 4.2Mhz NewFile4 Sine wave at 100Khz NewFile2 Triangle at 100Khz NewFile3