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

USB superspeed peripherals Forum Discussions

MaXi_1246331
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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.

0 Likes
1 Solution
7 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
100 likes received 50 likes received 25 likes received

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.

0 Likes

I hope to clear date before the host read data from an endpoint.Thank you.

0 Likes

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

0 Likes

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;

  }

  }

}

0 Likes

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

0 Likes

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.

0 Likes