ADC problem spike

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I have a problem using AD7888 with ATmega324PA.

 

I am measuring sine voltages f=50Hz, so T= 20ms on 6 channels, 7 and 8 AIN are connected to GND

SPI frequency is 125kHz and SPI mode is 3.

 

What happens is that from time to time I get one spike in measurements.

I preform 72 measurements to cover time frame of T=20 ms.

I'm only interested in max. values and e.g. on 1st channel I have max of 600 and one spike happens with value 1500 and this spike is not present in signal which I measure.

 

What could you suggest me to do?

 

Thank you in advance !

 

Regards !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You've given very little info, but I'll comment a bit.  Does it happen if the input is shorted/grounded?  Does it happen if the input is any other fixed value?  Does it happen if you change the SPI frequency (both higher and lower)?  Have you looked at the signals on a scope and verified that all the levels and timing looks good?  BTW, it looks like the difference between the spike and the actual value might be 0x600, hinting that your data starts with two false '1' bits.  No idea how that might be happening.  Does the spike always seem to be 0x600 high?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi !

 

thank you for suggestions!

 

I checked signal with scope and spikes don't occur.

Values in pictures are dec not hex, sorry I forgot to mention.

 

This spike happens also on higher frequencies.

 

I'll check for fixed values.

 

 

I tried to introduce some pauses like:

 

for(int i=0; i<150; i++)

{

    asm("nop");

}

 

between measurements and switching analog channels, but with no luck.

 

 

Spikes happen also when nothing is connected to analog channel, by that I mean input signal (230V 50 Hz) is not connected to transducer and after transducer comes OPA and ADC.

When nothing is connected ADC reads around 90 dec and spikes happen at random value 900 1300 ...

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are interrupts involved?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do you know the spike is in the measurement and not in the transfer of the data?

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 Does it happen if the input is shorted/grounded?

+1

 

That is critical info, as it helps to sort out a software issue, or perhaps a current surge on the ground plane, etc., in addition to the spike coming in via the ADC pin, Aref, the Power Supply, etc.

 

It would be helpful to see at least a block diagram of the setup.

What is the input source?

 What is the power supply?

What do you have for anti-aliasing filter on the front end?

 

Can you set a pin high whenever the ADC sees the spike, and use that to trigger a good storage O'scope, so you can look slightly before the spike appears in the ADC channel to see the actual input signal to the ADC pin, and to the various stages of the analog front end, and the power supply?

 

JC

 

Edit: Typo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

Can you set a pin high whenever the ADC sees the spike, and use that to trigger a good storage O'scope, so you can look slightly before the spike appears in the ADC channel to see the actual input signal to the ADC pin, and to the various stages of the analog front end, and the power supply?

If no input spike is seen, I'd also capture and examine the SPI signals on this trigger.

 

Also, as mentioned, if there are any interrupts that could break a non-atomic data access, that could also explain the spikes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You fail to say how often the spike happens...10 times a minute, once a day, etc.  If it is rare, you must use you scope very carefully, so you don't take "one sweep" and say, yep , no spikes there.

The power line voltage is very full of spikes.

 

If the spikes are really there you could add component filtering & spike removal software...a big spike (much larger than the running data)is easier to identify & remove, than a little spike that "could be"  real values.  Not any component filter might make it harder for software to identify & reject, since such filtering blends it to look like a good signal.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could also be due to a glitch when you change the mux. This would most likely be timing related, so becomes seemingly random.