Handling partial data transfer on PC side. AN75779

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

cross mob
Anonymous
Not applicable

I'm wondering the best way to handle a partial data transfer on the PC side?  On the FX3, my DMA callback gets executed during a partial buffer like it should and performs the proper steps however, on the PC side I don't know the proper way to handle data xfer.  I always get out of sync.  I don't know what the size of the data xfer is and what to put in "bytes" length to xferdata function on the PC side.  Is there away to stuff the buffer on the FX3 side so the buffer is always the same size?  What is the best way to handle this situation?

   

Thanks a ton for the help!

   

Brandon

1 Solution
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

CyU3PDmaChannelSetWrapUp/CyU3PDmaMultiChannelSetWrapUp API wraps up the current active producer socket, but CyU3PDmaSocketSetWrapUp wraps up the DMA buffers corresponding to a socket.

The former API is usually used for syncing as it blocks other operations of the buffer while the API is running, which is not the case for CyU3PDmaSocketSetWrapUp.

Best Regards,
AliAsgar

View solution in original post

0 Likes
6 Replies
Anonymous
Not applicable

If the data that device is sending is less than the Xfer call, then to finish the Xfer, the device needs to send a ZLP (Zero Length packet). On detecting a ZLP, the host will finish the Xfer call so you do not need to worry about the size of data coming from the device

0 Likes
Anonymous
Not applicable

Nishant,

   

Thank-you for your help!  I'm wondering, does the  CyU3PDmaSocketSetWrapUp (CY_U3P_PIB_SOCKET_0); function do what your talking about or do I still need to send a ZLP? Or both?

   

 

   

Thanks,
Brandon

0 Likes
Anonymous
Not applicable

You need to send a ZLP. The CyU3PDmaSocketSetWrapUp will only commit the buffer, so you need to send a ZLP after that to indicate the host the  end of transfer

0 Likes

What is the difference between CyU3PDmaSocketSetWrapUp and CyU3PDmaMultiChannelSetWrapUp ?

0 Likes
Anonymous
Not applicable

Thank you!

0 Likes
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

CyU3PDmaChannelSetWrapUp/CyU3PDmaMultiChannelSetWrapUp API wraps up the current active producer socket, but CyU3PDmaSocketSetWrapUp wraps up the DMA buffers corresponding to a socket.

The former API is usually used for syncing as it blocks other operations of the buffer while the API is running, which is not the case for CyU3PDmaSocketSetWrapUp.

Best Regards,
AliAsgar

0 Likes