I have an update regarding my ADC board and driver. My test results are both encouraging and discouraging.
After thinking over the timing requirements and concerns regarding noise coming from the digital outputs banging around, I substantially changed the driver code. I'm still going with the T4.0 approach, but instead of driving the CNV\ and RD\ pins simultaneously, initially I just set RD\ LOW to read the data out from the last conversion. So the SAR stuff isn't running. At the end of the entire data acquisition I set RD\ HIGH and only then trigger the next conversion by pulsing CNV\ low for a bit over 10nS. Along with that, one important change was to implement a different approach to getting the necessary delays to make the ADC happy.
I've seen that changing various delays can radically change what's being read out from the ADC, so I did some extensive benchmarking of different approaches to getting repeatable delays and I only found a few that seemed useful for the purpose. The first, to get the fairly long ~45nS delays needed for the data outputs to settle, was answered by using the delayNanoseconds() function -- but the argument passed to the function is nowhere NEAR 45 (ns). It actually needs to be 27 ns. Probably due to setup and loop overhead in the delay routine. For the 10nS delay needed to make sure the ADC's conversion is properly triggered I found that adding a value to a
volatile 32 bit unsigned integer is just about right. To foil any compiler optimization stuff I chose a value that is not a power of 2, but to be honest I haven't evaluated if the choice of the constant makes any difference.
Other folks who want to use delayNanoseconds() will likely want to do their own benchmarking for their particular requirements. I noticed some really odd behavior for small arguments -- in fact, in some cases the delay DECREASED when I increased the value of the argument. So just subtracting a fixed overhead value from the delay you want won't necessarily work. You have been warned
.
After all that I fired up the driver code and got -- nothing. All zeroes. This was with grounding the input to the buffer amp. Well, H*ll. Out of desperation I connected the input to the ADC's Vref voltage. Whoa -- I got 65535! Exactly what one would expect. Well, now. Time to get out the signal generator and see what I get.
And here it is:
The signal generator was outputting about a 1V triangle wave for this. For further proof that the ADC baseline noise level is pretty low, I reduced the amplitude of the sig gen to 1mv p-p and I got this:
I think the signal generator's DAC isn't all that great, but it IS surprising to me that a 1mvp-p signal only spans 6 bits -- it should be closer to 27 bits. Maybe there's something else going here. Or maybe my cheap sig gen isn't all that accurate....something else to look at....
But now for the downer, and I'm sure you all noticed just now bumpy the larger-amplitude triangle wave looks. Well, that appears to be due to an assembly problem on my part. When I was soldering the ADC down I had a pretty difficult time and thought I had broken off one of the data pins. I was able to solder a wire from what (I thought) remained of the pin to the circuit board trace and called it a win -- but apparently the pin was NOT broken, but bent underneath the package. Where it shorted to an adjacent data pin. Now the funny bumps in the waveform make some sense
After looking at the situation very closely with my stereomicroscope, I don't think there is any way to rescue the board without completely removing the ADC chip and starting over again. If that's possible. I have a toaster oven I bought just for the purpose of soldering SMT parts (and heat treating metal) so that may work -- but some of the other stuff on the board may be toast. I'm thinking particularly of the headers, they don't seem to be particularly happy being exposed to molten-solder temperatures. But I do have several other boards. Probably the best thing to do is to order another ADC, just in case my rework attempt ends badly. And probably a few more headers.
The board I used for this only has one modification. I added a hefty jumper wire connecting the digital ground @C2 to the input ground pin. But I also made a special +5/Gnd connector that has a 10uF capacitor between the two, in an attempt to cut down on noise coming from the USB +5. None of the control signal lines have any series damping resistors -- if anything, that made things worse rather than better.
So Bruce may not find it necessary to do much, if any, modifications to the ADC board I sent him.
In retrospect what I _should_ have done was to pre-tin the ADC pads on the board, and do the same to the package pins. I've found that applying solder flux to the board and the package pins before tinning them has the happy effect of almost completely eliminating solder bridging (at least, when the flux is left on the board when they're soldered together). So using a relatively blunt solder tip (relative to a very small package pin) works out OK.