Fastest ADC measures with DMA
I'm using a Nucleo-G474RE to measure a signal via ADC1.
ADC measures are triggered by TIM2, then transferred via DMA1 into a large buffer (60KB).
When the buffer is full an interrupt is generated and I give the DMA another 60KB buffer.
After that, everything is stopped and I upload the buffers to the PC via LPUART1.
Finally I check the result with a 100Hz sinusoidal input.
So far so good, I can set TIM2 up to 3.86333MHz, but anything above will result in a sub-sampling output (between 2 and 3Msmpl/s).
That's 44 cycles (clock is 170MHz on all buses). I was expecting to go higher, since I set the ADC measure time to its minimum (2.5 cycles sampling time, 8 bits, no filtering), so a measure should take ~11 cycles, plus the DMA transfer (1 byte of data), so maybe 20 cycles per measure.
No transfer error or ADC overrun is reported, and nothing else runs during the measures.
My question is: what could possibly eat up 24 cycles per measure, and how to maximize the number of ADC measures per second?
