Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

YuWa_4674726
New Contributor

Hi,

I could send/read the data with C# (cyusb.dll) and every time I read 512 bytes.

But my full data's size is not a multiple of 512.

The function WaitForXfer() always returns false if the remaining data's size does not reach 512. These remaining data would interfere with the byte content next time.

So my question is how to receive these remaining data(less than 512).

Thank you !

0 Likes
1 Solution
YatheeshD_36
Moderator
Moderator

Hello,

For the application to read the data, the data should be committed to the endpoint buffer by the firmware. Please confirm the same.

You can use the synchronous Xferdata call, where you can specify the length of data that is to be read from the corresponding endpoint.

Refer to section "4.14.7 XferData( )" from the CyUSB.NET.pdf available in the FX3 SDK.

Thanks,

Yatheesh

View solution in original post

0 Likes
3 Replies
YatheeshD_36
Moderator
Moderator

Hello,

For the application to read the data, the data should be committed to the endpoint buffer by the firmware. Please confirm the same.

You can use the synchronous Xferdata call, where you can specify the length of data that is to be read from the corresponding endpoint.

Refer to section "4.14.7 XferData( )" from the CyUSB.NET.pdf available in the FX3 SDK.

Thanks,

Yatheesh

View solution in original post

0 Likes
YuWa_4674726
New Contributor

Hello,

Thank you for reply.

"XferData( )" is a wonderful way.But I hope to receive data continuously by the asynchronous approach.

So is it possible to read dynamic length data with the dll ?

Thank you!

0 Likes
YatheeshD_36
Moderator
Moderator

Hello,

Please check the value in the len field of the FinishDataXfer after it is called. It is supposed to hold the length of the data actually transferred.

If the endpoint has data, then len field will be non zero. If it is zero, then please check the firmware if the data is actually committed to the endpoint.

Also, you can use the  UsbdStatus and UsbdStatusString function to get the error from the last Xfer call by passing the return status.

Thanks,

Yatheesh

0 Likes