ADC -> USBFS (bulk) highest throughput

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi Forum,

   

 

   

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?

   

Any help or hints are appreciated!

   

 

   

Thanks,

   

Felix

0 Likes
3 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
0 Likes
Anonymous
Not applicable

Hi odissey1,

   

 

   

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.

   

 

   

Felix

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        I hope you read this paper from the above thread, 1Ms/s is a pain http://www.embedded.com/electronics-blogs/max-unleashed-and-unfettered/4439360/Achieving-1-mega-samp...   
0 Likes