cancel
Showing results for 
Search instead for 
Did you mean: 

"Jumps" in ADC output of stm32G474RET6 using DMA

Mshakiba
Visitor

I am running the ADC using a timer trigger and DMA to sample a sinusoidal signal.
The captured samples are transmitted to a PC via UART.
However, as shown in the attached image, the ADC output appears to be step-like and does not capture smoothly changing values, even though the input signal is a clean sine wave.
I have checked the external reference voltage, interrupts, and the microcontroller power supply, but the issue still persist

1000028368.jpg

3 REPLIES 3
TDK
Super User

Are you calibrating the ADC on startup? This is mandatory.

Are there appropriate decoupling caps next to the VREF+ pin?

Consider sharing the schematic if you can.

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

The error may be in your DMA code?

Try ADC sampling by polling first for checking analog input signal integrity.

hth

KnarfB

Andrew Neil
Super User

welcome to the forum.

Please give some more details about your setup;  in particular, your code & schematic - see:

How to write your question to maximize your chances to find a solution

 


@Mshakiba wrote:

as shown in the attached image, the ADC output appears to be step-like and does not capture smoothly changing values,


The images show that it does correctly capture the smoothly changing values most of the time - there is just a regular "glich" at a certain point in the waveform.

Does that glitch correspond to where your DMA completes?

Or where your UART transmission occurs?

Or something else that happens regularly in your system?

 


@Mshakiba wrote:

I am running the ADC using a timer trigger and DMA to sample a sinusoidal signal.


As @KnarfB said, have you tried it without DMA ?

Have you tried it with steady voltages - to see if it's something to do with that particular voltage range (rather than time-related) ?

 


@Mshakiba wrote:

I have checked the external reference voltage, interrupts, and the microcontroller power supply,


Have you checked the  actual input voltage at the STM32 pin ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.