- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to clear data in an endpoint for FX3 slavefifo example? What is the related code In slavefifo application note firmware? What should be the C++ code running in the host to match the clear operation in the firmware. Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is solved in this thread: How to let the control endpoint XferData function return true for FX3 device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer the CyFxSlFifoApplnUSBSetupCB callback fucntion in GPIFtoUSB example firmware (SDK path - C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxgpiftousb), particularly this IF condition (
if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)
&& (wValue == CY_U3P_USBX_FS_EP_HALT))
)
Please let me know when do you want to clear the endpoint data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I hope to clear date before the host read data from an endpoint.Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This question comes from the following case. I see no one answer me so I ask this quesion for substituion. Would you like to see the original question. It is in detail. Thank you so much.
How to let the control endpoint XferData function return true for FX3 device
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The above mentioned IF condition executes when the host sees that the endpoint is STALLed and send a clear feature over that endpoint.
If you want to clear the endpoint and reset the dma channel before start of data transfer, you can call RESET function before the start of a tranfser.
The corresponding host application code is as follows:
if (!pCtrlEndpt->XferData(&buf,len)) {
if (pCtrlEndpt->UsbdStatus == USBD_STATUS_STALL_PID) {
std::cout << "stall detected, resetting endpoint" << std::endl;
if (!pCtrlEndpt->Reset()) {
std::cerr << "Reset() failed" << std::endl;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After debugging, I find the endpoint can be reset by the above codes. But XferData will wait for a few seconds and return a false, or immediately return a false, depending on the firmware.I hope it returns a true immediately.
I think CyU3PUsbStall in the firmware decides the return of XferData in the host software. But I have tried many combinations of input parameters of CyU3PUsbStall.Only CyU3PUsbStall
(0, CyTrue, CyFalse) will immediately return false. Other combination will return false after a few seconds. What should be the first parameter of CyU3PUsbStall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What should be the first parameter of CyU3PUsbStall? In AN65974, it is wIndex which is the endpoint to be cleared. But I think it may be constant 0 instead, because XferData here is run by control endpoint. Anyway putting wIndex here will not return a true either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is solved in this thread: How to let the control endpoint XferData function return true for FX3 device