2025-11-15 9:46 AM
Hi, I need a little explanation about what is wrong behind my reasoning..
I am using STM32F411. reading, two inputs of ADC in scan mode over circular DMA triggered via TIM2 update event.
TIM2 is triggering ADC at 100KHz, so I have 50Khz sample rate per adc input. At input of both ADC channels I connected signal generator feeding 1Vrms sine @20KHz.
Everything works ok, I am using printf of both channels over (USB-CDC) as and I can see two sinusoide signals on serial plotter. I am using this serial plotter:
https://web-serial-plotter.atomic14.com/
Now the problem and confusion starts here:
If I change only TIM2 frequency to 10KHz, I am getting 10X lower sample rate also (now 5KHz pre channel, all checked with Logic Analyzer), but I still can see clear 20KHz sine at serial plotter, without degradation and this contradicts Nyquist theorem...
How is this possible and what I am missing?
2025-11-15 9:56 AM
In scan the trigger should cause both samples to be taken. The TIM can pace the sampling, but the sample rate of the ADC will determine how long the process takes and the saturation point.
For the sample to occur at the same instant you need DUAL mode where ADC1 and ADC2 are bound together.
2025-11-15 10:09 AM - edited 2025-11-15 10:10 AM
Yes, both samples are taken, that parts works ok and I never mentioned "sample to occur at the same instant ", have read what was my question?
ADC - DMA -TIM2 is working in background, I only print the values in superloop. (if that is important)
2025-11-15 10:13 AM
> How is this possible and what I am missing?
It's obviously not possible to see a 20 kHz sine wave with a 5 kHz sample rate. So one or more of your assumptions are incorrect.
Probably the ADC is being converted continuously, or you are not using TIM2 to trigger. Impossible to say without seeing code.