I previously reported on assembling the FG085 function generator kit and measuring its output impedance. I noted that the output impedance was only 46.7Ω, instead of 50Ω, and in Testing nFET body diode with function generator that the output current was limited to about ±5omA, which is ok for 50Ω at 5V peak-to-peak (±2.5V), but not enough when the maximum offset of 5V is added (or –5V, for that matter). I also complained about the buttons (particularly F/T and 0) needing to be pressed up from below, because the return springs weren’t strong enough to push the buttons back up.
I also noted in the first post that the cheap and noisy DAC had some bad glitches. I decided to investigate that a bit more today, using the new version of PteroDAQ. The voltage calibration was reasonably good on the KL25Z board (about 0.28% too high), so I decided to use that one with 32× hardware averaging.
I set the FG085 function generator to 3.1V peak-to-peak and a 1.7V offset outputting a 1Hz upward ramp, and recorded for about 2 minutes (603882 samples). Looking at a couple of periods shows the glitches:
Although the glitches are visible, there seems to be some measurement noise. Indeed, zooming in makes the noise very evident:
I wrote a program (which I’ll be releasing after I do some more polishing on it, as part a suite of tools for analyzing data generated by PteroDAQ) to average copies of repetitive waveforms to reduce noise and get finer temporal resolution. This is similar to the code I wrote for dejittering the BitScope recordings, and I plan to merge the tools so that I don’t need two sets of software tools. Averaging 120 periods makes the waveform much cleaner—here are essentially the same two plots as above, but with the averaged waveforms:
Let’s also look at the top and bottom of the waveform, to see how well the voltage and period are set:
The voltages were supposed to be 150mV and 3.25V, but instead came out as 64.44mV and 3.2563V. The top end is about right but the offset is 1.66V instead of 1.7V and the peak-to-peak voltage is 3.1919V instead of 3.1V. I don’t know if these are hardware errors (as the DAC nonlinearities are) or an off-by-1 error in the software that sets the peak-to-peak voltage.
The period being 0.845% too long is almost certainly a software error—the crystals aren’t that far off. It looks like they are almost exactly 2 steps off on the duration, as if they had added one instead of subtracted one from 256 somewhere. They claim a frequency error of at most 0.0005960 Hz when frequencies are below 40Hz, and the observed error is 14 times that. I am reasonably certain that the error is in the function generator, not PteroDAQ, since I get similar error when measuring with the BitScope digital oscilloscope.
The ¼-way glitch shown above is not the biggest one—the ½-way one is bigger:
I suspect that the error comes from not including the output impedance of the digital outputs in making their crude DAC, so that the resistor ladder is not properly balanced. But relying on digital output pins having carefully matched output impedances is a state of engineering sin.
Overall, the FG085 looks like a decent student project (maybe B work), but not the work of professional engineers.
Update 2015-Jul-16: Just a little after publishing this post, I checked the firmware release info on the FG085, and it seems that I don’t have the 113-08502-053 [ 2014.08.01 ] release of the DDS core firmware which “Fixed a bug that caused frequency error when frequency setting is less than 40Hz.” So now I have to figure out how to update the firmware. The manual assumes that you have an AVR programmer, but I’ll be using an Arduino as ISP, which takes a while to look up and set up.
Update 2015-Jul-16 21:29:
I did the firmware upgrade, which took me much longer than I thought it would, because I had to install avrdude again, edit the ArduinoAsISP sketch to work with the Leonardo board, edit the avrdude.conf file to include m48p (it only had the m48, which has a different signature), and generally debug using the Arduino as an in-system programmer. The command I ran that finally worked was
avrdude -c avrisp -p m48p -P /dev/tty.usbmodem24141 -b 19200 -U flash:w:113-08502-053.hex -v -v -v -v
I recorded the waveform and now get a period of 1.0005 seconds, which is just within spec for the FG085.