How to judge whether the in input buffer of cyusb3014 has data?

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

cross mob
qiwec_297866
Level 2
Level 2
10 sign-ins 10 questions asked 5 replies posted

1、If I use the in Endpoint of cyusb3014  to receive data continuously, which can be suspended by FPGA logic, how to judge that the in buffer of 3014 has more data to avoid the error of reading, When I suspend the continuous input data.

2、If I suspend the continuous input data, how to clear the useless data of in buffer of 3014 to avoid the mistake reading of next start?

0 Likes
1 Solution
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

1. You can setup a counter in DMA producer event and decrement it in the DMA Consumer event. This tells whether there is any data left in the DMA memory (DMA buffer) NOT the endpoint memory. Looks like there is no API to read whether there is any data in the Endpoint memory. It is good to reset the endpoint and DMA buffer when there is suspend and resume of data flow.

2. Please refer CyFxUvcApplnStop in the AN75779. This handles the stopping the GPIF, clearing the DMA and Endpoint memory. You can implement the same in your code. Also refer CyFxUvcApplnStart.

View solution in original post

0 Likes
1 Reply
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

1. You can setup a counter in DMA producer event and decrement it in the DMA Consumer event. This tells whether there is any data left in the DMA memory (DMA buffer) NOT the endpoint memory. Looks like there is no API to read whether there is any data in the Endpoint memory. It is good to reset the endpoint and DMA buffer when there is suspend and resume of data flow.

2. Please refer CyFxUvcApplnStop in the AN75779. This handles the stopping the GPIF, clearing the DMA and Endpoint memory. You can implement the same in your code. Also refer CyFxUvcApplnStart.

0 Likes