2025-12-29 8:34 PM - last edited on 2025-12-30 3:21 AM by Andrew Neil
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
2025-12-29 8:48 PM
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.
2025-12-30 12:46 AM
The error may be in your DMA code?
Try ADC sampling by polling first for checking analog input signal integrity.
hth
KnarfB
2025-12-30 3:20 AM - edited 2025-12-30 3:53 AM
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 ?