Maximum DMA Buffer sizes for USB 2.0 and USB 3.0 different?

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

cross mob
Anonymous
Not applicable

Hello

   

 

   

According to my understanding there is 256 kB memory available for DMA buffers by default. In my application I create two DMA channels each with count=1 and size = USB packet size. In addition, I want to create a MultiDMA upstream channel (2 to one) that uses all the remaining memory available. For USB 3.0 I am using count=126 and size=1024 (126*1024*2=252 kB) for the MultiDMA channel, which is working. However, when connected to a USB 2.0 host, I would like to use count=252 and size=512 (252*512*2=252 kB) but the DMAMUltiChannelCreate function returns "16" which means "CY_U3P_ERROR_MEMORY_ERROR". After some try and error, I found that maximum count value for USB 2.0 seems to be around 80, which results in only 82 kB buffer size. What can be the reason for this?

   

 

   

-Silvio

0 Likes
2 Replies
Anonymous
Not applicable

There are two reasons why a CyU3PDmaChannelCreate (or CyU3PDmaMultiChannelCreate) API returns the CY_U3P_ERROR_MEMORY_ERROR code. 

   
        
  1. DMA buffer allocation failure
  2.     
  3. DMA buffer descriptor allocation failure: The buffer descriptors are structures that keep track of the size and state of each DMA buffer. There are a total of 512 descriptors available on the system. Each buffer requires one descriptor in the case of AUTO channels, and two descriptors in the case of MANUAL channels. 
  4.    
   

In your case, the attempt to create a multichannel with a count of 252 would fail because the a MANUAL multichannel with a count of 252 will require 1008 descriptors. There is no dependency on the USB connection speed. We have verified that we are able to create DMA channels with a count 126 in both 2.0 and 3.0 cases.

   


0 Likes
Anonymous
Not applicable

This makes sense. So I will increase the DMA buffer size to get around this problem. Thanks for letting me know.

0 Likes