Question of USB and Streaming Data

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

cross mob
Anonymous
Not applicable

I have an application were I am receiving data over RF at a "constant" rate of 500 Kbps for some hours and I need to get that data to a Linux machine so that it can store the data into bulk non-volatile memory. Right now on the Linux machine I am using libusb-1.0 to read the data that is received from the PSoC.

   

For simplicity, I have started by doing a simple bulk transfer with one endpoint after I receive a given packet; however, this clearly can not work since the shortest polling interval for a bulk transfer is 10 ms. Also I am not sure what throughput I could expect if I were to gather 512 bytes worth of data then send that data with a bulk transfer.

   

I did some quick math and it should take ~8 ms to receive 512 bytes worth of data over RF so a 10 ms transfer interval, so a bulk transfer solution with a single end point might not work.

   

Failing the bulk transfer, I was thinking about setting the transfer up to look like usbuart and just clock the data out far faster than normal uart data rates. If I were to do this, is there a good way to receive this data over usb in a Linux environment since the data rate wouldn't be a standard uart baude rate?

   

Mutant usb uart would be a great way to handle the data transfer if there was a nice easy way to receive it on Linux.

   

Finally, as a last resort, I was thinking about going with an isochronous transfer. I downloaded the an56377 and it has an example that does this with DMA and can apparently hit data rates up to 800 KB/s which would be more than plenty of course; however, I would like to avoid the added programming complexity Linux side.

   

 

   

As always, I appreciate all and any advice, and I look forward to our discussion.

7 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

jlangfo5,

   

Problem of getting 1 M sample/s has been discussed in this forum before and summarized in the "embedded.com":

   

http://www.embedded.com/electronics-blogs/max-unleashed-and-unfettered/4439360/Achieving-1-mega-samp...

   

 

   

The bulk transfer to the Linux described here:

   

https://vimeo.com/64097918

0 Likes
Anonymous
Not applicable

Odissey1,

   

Thanks for the embedded link, the author implied that one could probably get 500 ksps SAR ADC data off the PSoC using the full speed isohronous transfer. His final solution seemed to be emulating a high speed usb transfer using the digital blocks and unrolling the c code to control it by hand.

   

I don't think I will have to go through the same lengths as the author did in order to get the data off of the PSoC in a timely manner.

   

Thanks for the video about the bulk transfer with libsub. I wish I had watched it much sooner as I would have arrived to the point in time that I am at now were I now think that bulk transfers will not be appropriate for my application since they can not send at a rate any faster than 10 ms per transmission and are limited to 64 bytes per transfer. Please correct me if I am wrong about that last point :).

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

jlangfo5,

   

There is a post by 'dvorakvik' with example, which may be relevant to your question on 64 bytes length:

   

http://www.cypress.com/forum/psoc-5-device-programming/psoc5lp-how-send-longer-lines-usb-cdc-maximum...

   

 

   

590 kBs transfer rate using USB CDC reported here (and some other threads):

   

http://www.cypress.com/forum/psoc-creator-software/usbuartputdata-does-not-work-64-bytes?source=sear...

   

 

   

And here is original thread for "getting 1 MSPS samples off of the PSoC" for the link above (embedded.com)

   

http://www.cypress.com/forum/psoc-5-device-programming/getting-1-msps-samples-psoc?source=search&key...

0 Likes
Anonymous
Not applicable

Hey! Just an update on how this has gone. I was able to get the data rate I needed using the isochronous dma transfer. I have a small lib usb program running on a PI that grabs the data and stores it as it comes in.

   

 

   

I might be able to post source code later is anyone is interested in seeing how I got the isochronous usb transfer to work with a lib usb applicaton.

   

 

   

Thanks for the help!

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Please post the code example for common benefit. The question of high-speed transfer of data is commonly asked.

   

odissey1

0 Likes
niprc_2224616
Level 2
Level 2
Welcome!

Bump.  Is the source available?

0 Likes

I, too, would love to see the source for this...

0 Likes