ADC Noise on ATMega8?

Mike Panetta <[email protected]> 29 May 2003 13:32:04 -0400
Newsgroups gmane.comp.hardware.avr.general
Message-ID <1054229528.10274.38.camel@Sikozu>
Has anyone experienced excess noise (in excess of 40mV) while using the
ADC on the ATMega8?  I am trying to rig up a battery monitor, and my
circuit works fine on the STK500 with an ATMega32, but on my circuit
board with a TQFP version of the ATMega8 on it has a somewhat random
looking voltage with peaks up to and beyond 40mV showing up.  

I have tried using the ADC sleep mode, but I can't get that to work (it
never seems to do the conversion, but it wakes up just fine???).  Anyone
here have example code that I could look at to see what I am doing
wrong? 

To narrow things down a bit I tried converting both the internal 1.23V
(Vbg) voltage (ADMUX = 0x0E) and the 0V mux input (ADMUX = 0x0F), and
both have the 40mV error voltage show up.  Should external noise at the
ADC pins (if it even exists) affect these internal conversions at all?

I have measured my external ref voltage and my AVCC and AGND with a VOM
(a pretty precise HP one too) and I see no more then 1 or 2 mV of
deviation on these pins, if even that.  I am using an external 3V
reference (to make the math easy with the voltage divider I am using)
and I have checked that circuit too, and its all within tolerances (less
then 47mV off, and less then 1mV of noise [around .1mV]), so I do not
think any noise is coming in here either.

I am really stumped, so any help would be really appreciated.  I just
hope its not the board layout thats at fault here, but if someone wants
to look at that for me I can send you a couple of post script files of
the layout in private email, to knock that one off the checklist of
baddies too...

Thanks,
Mike