1 2 Previous Next 17 Replies Latest reply on Jun 15, 2012 1:02 AM by rama.sai.krishna.vakkantula Go to original post
      • 15. Re: STALL handshake in Control-OUT transaction
        lukas.pusch

        Hello,

           

        if've the same problem with CyU3PUsbGetEP0Data and CyU3PUsbStall.

           

         

           

        Is there any example without the issue?

           

        I write on UART continously the string given in example "Data tracker: buffers sent: %d.\r\n".
        Now if I call the function

           

        status = CyU3PUsbGetEP0Data(4096, glEp0Buffer, NULL);

           

        there is no more output on UART.

           

        My code:

           

        [...]

           

        uint8_t glEp0Buffer[4096]; //length has to be multiple of 16 bytes

           

        [...]

           

        switch(vReq) {

           

            case VR_WRITE:
                CyU3PDebugPrint(2, "write\r\n");
                status = CyU3PUsbGetEP0Data(4096, glEp0Buffer, NULL);
                if(CY_U3P_SUCCESS == status ) {
                    CyU3PDebugPrint(2, "success\r\n");
                }
                else {
                    if(status == CY_U3P_ERROR_BAD_ARGUMENT)
                        CyU3PDebugPrint(2, "CY_U3P_ERROR_BAD_ARGUMENT%x\r\n", status );
                    else
                    CyU3PDebugPrint(2, "error%x\r\n", status );
                    CyU3PUsbStall (0, CyTrue, CyFalse);
                }
                break;
            case VR_READ:
                CyU3PDebugPrint(2, "read\r\n");
                status = CyU3PUsbSendEP0Data(4096, glEp0Buffer);
                if(CY_U3P_SUCCESS == status ) {
                    CyU3PDebugPrint(2, "success\r\n");
                }
                else {
                    CyU3PDebugPrint(2, "error%x\r\n", status );
                }
                break;
            case CY_U3P_USB_TARGET_ENDPT:
                if(wValue == CY_U3P_USBX_FS_EP_HALT) {
                    /* Clear stall on the endpoint. */
                    CyU3PUsbStall (wIndex, CyFalse, CyTrue);
                }
                break;
        }
        [...]

        • 16. Re: STALL handshake in Control-OUT transaction
          rama.sai.krishna.vakkantula

          On FX3, it is not really possible to stall the status phase of a control transfer after the data phase is completed. This is because the firmware has no control on when the status phase happens and we may end up trying to stall the EP after the status phase is completed. (Essentially, stalling the status phase is a hit or miss operation. It may or may not work depending on how fast you do the stall and how much time the host gives you between data and status). 

              This is why we are documenting that you can use only one of the four APIs (UsbAckSetup, SendEp0Data, GetEp0Data and UsbStall) in response to a control request. Once you have used GetEp0Data to get the data, you cannot call UsbStall to stall the request.
          • 17. Re: STALL handshake in Control-OUT transaction
            he.kongkui

             CY_U3P_USB_VENDOR_RQT:厂商请求

               
                CY_U3P_USB_STANDARD_RQT:USB标准请求    
            我要是直接发送CY_U3P_USB_VENDOR_RQT类型的请求就可以,但我要是先发送一个CY_U3P_USB_STANDARD_RQT类型的请求(非USB规定的那十几种标准请求)会返回错误(正常情况下会反回错误,因为没有对这个标准请求进行处理),但我再发送CY_U3P_USB_VENDOR_RQT类型的请求还会反回错误,知道为啥不    
            1 2 Previous Next