Some questions on using XferData() API call with Isochronous IN Endpoints

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

cross mob
Anonymous
Not applicable

  I am using CY8CKIT-050 PSoC 5LP development kit, connected to a Windows 8 PC through Full Speed USB 2.0. Can somebody help me in understanding how the 'XferData(buf, bufLen, pktInfos)' API call works for Isochronous IN endpoints?

   

 

   

1. Cypress CyAPI Programmer's Reference manual (2011) mentions on page 8 that the XferData() call is overloaded to take an additional argument 'pktMode'. If pktMode is true, then the partial data transfer is enabled at an IN end point. However, when I used this call for an ISOC IN Endpoint with pktMode = true, then the compiler gives an error saying 'Too many arguments in function call'. Does this parameter valid for ISOC IN EPs? If yes, then how to use 'pktMode' argument in XferData() call for ISOC IN EP?

   

 

   

2. I have configured an ISOC IN EP with maximum packet size of 1023 bytes and DMA transfer with Automatic Memory Management. I have set the end point transfer size for this EP as 8184 bytes (8 times 1023) using SetXferSize() call. Now, while using 'XferData(buf, bufLen, pktInfos)' API call with this EP in host application:

   

 

   

(i) Should the buffer ('buf') size, and 'bufLen' value be always 8184 bytes (8 times 1023)? Or, should the  'bufLen' value must be equal to maximum packet size (1023)?

   

 

   

(ii) Can we use 'bufLen' value less than 8184, while keeping the buffer size still to be 8184 (For example, in cases when we want to receive less than 8184 bytes)?

   

 

   

(CyAPI manual says that bufLen should be 8 times the maximum packet size, but  I suspect that I am receiving excess data in host application on doing so.)

0 Likes
1 Reply
Anonymous
Not applicable

 Hi Manuj,

   

 

   

The XferData() call for isoc endpoints has an additional structure which contains data about the exact amount of data received from the device. This is the 'pktInfos' field.

   

Explanation and example code is available in the reference guide. Did you take a look at it? Can you let us know what exactly is not clear here so that we can assist you better?

   

 

   

In general, isoc transfers need to have a x8 factor for the length because isoc data is requested in terms of frames. And since the endpoint max packet size is in terms of bytes/microframe and there are 8 microframes in one frame, the x8 factor comes into the picture. You can take a look at the explanation given here:

   

http://msdn.microsoft.com/en-in/library/windows/hardware/hh406225%28v=vs.85%29.aspx

   

 

   

The 'pktmode' argument is only valid for bulk endpoint data transfers. It is used to make tranfers that are not a multiple of endpoint max packet size. It is not valid for isoc endpoints as the transfers for isoc endpoints are always in terms of data available in one whole frame (and this is always a multiple of endpoint maxpacketsize).

   

 

   

In cases where you want to receive less than 8184 bytes, you should still queue a bufLen of 8184 in the XferData call. The device can send lesser than this, in which case the isopkts structure would be updated with the correct length field based on exactly how many bytes of data the device has sent (this can be <=8184).

   

 

   

Regards

   

Shashank

0 Likes