2021-08-22 10:06 PM
Hello, I am trying to send ADC data (12 bit) to pc with USB as fast as possible. Now I am using STM32F405 and configured ADC like picture below. Those data of ADC is transfered to the pc by interrupt of DMA which is cirucular mode. And the data transfer rate is around 10k bps. Is this reasonable value? Is there better way to transfer faster than this ?
Solved! Go to Solution.
2021-08-23 12:04 AM
ADC stores either uint8_t or uint16_t values, depending on resolution. A buffer of uint32_t values isn't useful here.
Otherwise, the code is correct.
2021-08-22 10:20 PM
You'll need a buffer on the STM32 side to handle latency in the USB stream. Max FS USB data rate is going to be something near 8Mbit/s. Sending larger buffers over DMA will yield higher throughput.
ADC and USB are independent. I would transfer ADC data into a separate buffer and send that over USB as fast as possible.
2021-08-22 11:19 PM
Thank you. I have another question. In cirucular mode, how can I change the buffer for DMA? Is code below accurate?
uint32_t buffer[100];
HAL_ADC_Start_DMA(&hadc1, (uint32_t *)buffer, sizeof(buffer)/sizeof(buffer[0]));
2021-08-23 12:04 AM
ADC stores either uint8_t or uint16_t values, depending on resolution. A buffer of uint32_t values isn't useful here.
Otherwise, the code is correct.
2021-08-23 04:09 PM
Thank you for your help.
I will try.
2023-07-10 05:24 AM
Can you please tell me how were you able to make USB and DMA working together? I am using the same clock configuration as you even the parameter setting for the DMA are same. When I disable the Continuous Conversion mode the USB port shows up but when I enable it; it doesn't show up.
PS: I am able to send a string when the ADC and DMA were disabled.