cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405RG weird ADC spikes

LLOLO.1
Associate II

Hi I am working on a small project where I need to sample couple of ADC channels.

I am using STM32F405RG. ADC1 is running in continuous and scan mode with DMA. I am using ping pong buffers to send ADC data through USART.

After gathering some data I plot them in MATLAB.

Problem is that there are random spikes in my ADC values an example is shown below.

X axis is Seconds, Y axis is voltage. Graph belongs to an ADC channel where approximately 2.6 volts needs to be read.

0693W000005B0hlQAC.png 

Has anyone encountered this ?

32 REPLIES 32

ground has also spikes.

Yes design has ground plane. I have recommended capacitor configuration according to datasheet. Yes my CPU sleeps while waiting for DMA. I disabled the low power modes but the results didn't changed. There is nothing on my analog input. PA2 (ADC1 ch2) connected directly to external function generator. There is nothing in between. I don't think this problem is due to WiFi. I have only my phone in my pocket :\

That doesn't sound good.

A proper and stable power supply at least for the analog branch (Vdda) is required to get stable results.

Sounds like a PCB redesign for me ...

tkor.1
Associate II

Try to run another program such as DC voltmeter, check for spikes DAC pin on grand, you should have straight pure line on 0V. For grounding use wire jumper not a capacitor.

Still there are spikes. However, I realized that some of the spikes have exactly same value. If this was due to capacitor charge//discharge shouldn't the values change slightly?

Ground in scope is clean I am talking about ADC values when ADC input is connected to ground.

Is it possible to keep the same set up and read the Vrefinternal channel? That is the internal voltage reference. Then try the same with not function generator connected. I assume your function generator is mains powered. I would try to design all tests to be disconnected from mains powered devices and to be battery powered (no switching power supplies anywhere - not even nearby. Test for interference: Get a portable AM radio and slightly off-tune it to a low frequency radio channel and see what is producing the most electromagnetic noise in your room)

TDK
Guru

> ground has also spikes.

If you're tying "ground" to the ADC channel input and you still see spikes, it's unlikely to be a software issue and unlikely to be a problem than can be fixed by software changes. The SAR ADC within the STM32F4 isn't going to read significantly more than 0 counts in this configuration. It could be that the "ground" you're tying is a different potential than "VSSA," at least during some transient periods. Could also be something damaged in the ADC itself, but seems less likely to me.

If you feel a post has answered your question, please click "Accept as Solution".

So assuming it is not a software issue, where should I look first? VDDA line?

I checked VDDA and its stable during sampling.