Using USB DMA to stream ADC data

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

cross mob
Anonymous
Not applicable

I have read through all the DMA notes and USB datasheet and I am just a little confused conceptually on the best way to steam ADC data over USB. I am using the EOC on a Sequencing ADC to trigger a DMA channel from the final array of the ADC to the a ping pong buffer, and I would like to stream the data over USB. Using DMA with manual buffer management this is pretty straightforward: Each TD triggers an interrupt and the ISR sends the inactive (full) buffer to the USB using loadInEP().

   

I was thinking it would be better to use USB DMA with automatic buffer management since it would enable the use of a larger buffer for each loadEP (it is an ISO endpoint), but since the source array changes each time I need to call load it seems like I would have to call loadEP twice? the first time sets the new source array and the second time triggers the DMA? this is more complicated than the manual DMA it seems for this kind of setup.

   

If I set up DMA directly from the ADC results buffer (two bytes, since I am sequencing two channels at 8-bits each) to the USB ISO endpoint would it buffer them and send a full packet at once or would it just send a ton of two-byte packets?

0 Likes
3 Replies
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received
0 Likes
Anonymous
Not applicable

I have been reading that appnote and playing with the examples, and have read that thread. What I still don't understand is what triggers the DMA transfer in automatic mode. Is it just a call to USBFS_LoadInEP, with NULL in the second parameter? what is the advantage of that over just calling it with a buffer in the second parameters? It doesn't seem very automatic if i have to poll USBFS_GetEPState like in the example and then manually call LoadInEP when it is ready. Especially if I am streaming data from an ADC then I will probably have two buffers in a ping-pong setup so I can't just rely on the pointer passed in the first call to LoadInEP (?)

0 Likes
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

For ping-pong operation we recommend you to have a look at the project from the link:https://www.element14.com/community/thread/28830/l/psoc-4-pioneer-kit-community-project102-usb-audio... . This is an old project might not directly work with the new version of Creator. However the DMA configuration can be adopted to your design.

   

Basically the DMA with Automatic memory management is suitable for the data transfer in which the buffer is not changing regularly. However you can also use it when buffer is changing to, but just note that it will take some extra time for configuring the DMA for the new source address.You can offload CPU from the data transfer activity.

   

Thanks,

   

Hima

0 Likes