2024-12-27 06:22 AM
Can the ADC write to the buffer faster than the buffer values are sent to PC?
- Single channel ADC using DMA, non-circular, EOC every conversion
- ADC is in 12-bit resolution but as I understand it writes a full 16-bits each conversion
- Buffer size 1000 values
- Data rate from ADC 500MHz
- using HAL_ADC_ConvCpltCallback to invoke CDC_transmit_fs() to send the 1000-value buffer over UART (virtual com) at default value (I think 12mbps, whatever the default is).
The ADC to DMA is always running (does not stop for CPU due to using DMA) and I am getting weird values which makes me think the ADC to DMA values being written to the buffer are 'outrunning' the communication to PC and overwriting values mid-send, is that possible with the above setup?
2024-12-27 07:15 AM
The USB CDC ACM transfer speed depends on the receiving application on the PC side. With the proper app design, it's easy to get approx. 300 KB/s. In theory, close to 1 MB/s should be possible.
We know nothing about your ADC/DMA setup. You should probably be using ping-pong double buffer for continouous acquisition and transfer.
2024-12-27 01:52 PM
Data rate from ADC 500MHz
How can that be? The maximum F4 ADC clock is 36 MHz. Each conversion takes sampling clocks plus 12 conversion clocks. Ideal data rate is more like 2 MHz, in practice, lower.
as I understand it writes a full 16-bits each conversion
It writes 12 bits conversion justified right or left in 16 bit word.
I think 12mbps, whatever the default is
If that is the default, it equals 750 KHZ 16 bit words. So yes, "outrunning" is possible.