- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need to check from the PC if I have data available before initiate a bulk read on the PC.
Should I need to implement myself a Vendor request that replies with the CyU3PGpifGetSMState() for example ?
(or something similar ?)
I see it responds to the standard commands get_status 0x80, 0x81, 0x82 but I don't see these giving me any useful information.
Any Help ?
Luis C.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
There are no standard commands to know if the endpoint is filled with data.
One thing that you can do is to use a manual DMA channel and continuously monitor the event CY_U3P_DMA_CB_PROD_EVENT and CY_U3P_DMA_CB_CONS_EVENT. Declare a variable and increment it whenever a PROD event occurs and decrement the same when a CONS event occurs. If the variable value is non zero then there is data buffer available to be read from the endpoint .
Best Regards,
Yatheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
There are no standard commands to know if the endpoint is filled with data.
One thing that you can do is to use a manual DMA channel and continuously monitor the event CY_U3P_DMA_CB_PROD_EVENT and CY_U3P_DMA_CB_CONS_EVENT. Declare a variable and increment it whenever a PROD event occurs and decrement the same when a CONS event occurs. If the variable value is non zero then there is data buffer available to be read from the endpoint .
Best Regards,
Yatheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Yatheesh,
Thanks for your reply. Indeed very helpful.
As the SlaveFifo design for FX3 actually uses a manual DMA I firstly had to modify the
dmaCfg.notification
from:
/* Enabling the callback for produce event. */
dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;
to:
/* Enabling the callback for produce and consume events. */
dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;
Then added at the end of the DMA callback function "CyFxSlFifoPtoUDmaCallback"
...
if (type == CY_U3P_DMA_CB_PROD_EVENT)
BufferAvailable++;
if (type == CY_U3P_DMA_CB_CONS_EVENT)
BufferAvailable--;
}
Works perfectly.
Thanks.
Luis C.