Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I am working on a project for which I just need to read 4 SAR ADC channels as quickly as possible while streaming the data back to a PC using bulk transfers with USBFS.
The problem I keep running into is that the maximum sampling frequency seems to be limited to ~30 kSPS per channel - for a total of 120 kSPS on all four channels. Whenever I try to go beyond that, my device is either dropping packets (IRQ controlled) or crashes the USBFS (DMA controlled). So I suspect I am probably missing something. The two strategies I have tried so far are outlined below:
1. IRQ based - Here, I use the conversion complete interrupt to write values and set a data-ready flag. I am polling in the main loop and every time a new sample is there, I initiate a DMA transfer to the USBFS component. This is working robustly, but breaks down at sample rates > 30 kSPS per channel (120 kSPS total). It seems like retrieving the values from the ADC final buffers can't happen fast enough - when fetching data is commented out, throughput on the USB bus goes up to >800 kB/s.
2. DMA based - In this case I tried to circumvent the data fetching problem by setting up DMA transfers triggers by the eoc signal. Here, 8 bytes (4 channels) get transferred to a buffer (64 bytes) upon end of each conversion. When 64 bytes are transferred this way, an IRQ is used to initiate another DMA transfer from the buffer to the USBFS component. This also works fine at lower conversion speeds, but upwards of ~30 kSPS, the PSoC seems to crash after a few seconds and there is no more USB data coming in to the PC.
What am I missing here? Is there another strategy people typically use to obtain the highest throughput for streaming ADC data via USBFS?
Thanks for the hint, I was looking at isochronous transfers before. For me, the problem is driver support in Win7 as well as the lack of error correction in that mode.
The peculiar thing is that I can get >800 kbyte/s throughput in bulk mode, but only when transferring an empty buffer. Because of that, I figured I don't manage to move ADC data around fast enough to make the PSoC work for my application. I realize that what I am trying to do is close to the limit, but was wondering if anybody has achieved fast data transfer from ADCs.