2020-11-10 10:12 PM
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.
Has anyone encountered this ?
2020-11-12 09:32 PM
ground has also spikes.
2020-11-12 11:05 PM
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 :\
2020-11-13 01:32 AM
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 ...
2020-11-13 01:52 AM
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.
2020-11-13 02:04 AM
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?
2020-11-13 02:36 AM
Ground in scope is clean I am talking about ADC values when ADC input is connected to ground.
2020-11-13 02:35 PM
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)
2020-11-13 04:03 PM
> 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.
2020-11-16 01:56 AM
So assuming it is not a software issue, where should I look first? VDDA line?
2020-11-16 05:04 AM
I checked VDDA and its stable during sampling.