6 Replies Latest reply on Feb 3, 2019 1:24 AM by SrinathS_16

    Xferdata() fail on bulkin endpoint

    zqli_4003376

      Hi,

      //Do some init

        if (!Device->BulkOutEndPt->XferData(data, outlen))
        {
         Device->BulkOutEndPt->Abort();
         return false;
        }

       

        if (!Device->BulkInEndPt->XferData(indata, inlen))
        {

      //fail on bulkin
         Device->BulkInEndPt->Abort();
         return false;
        }

       

      And I can read out data by Cypress Control Center right after fail. I checked code and can not find different.

      Can you help to check it, thanks.

        • 1. Re: Xferdata() fail on bulkin endpoint
          SrinathS_16

          Hello,

           

          - Please let us know which device you are using.

          - Also, ensure that the data is committed from the device to the host. In case you are using FX2LP, either the AUTO commit option (or) EPxBCH:L register loading commits the data to the host. In case you are using FX3, either the AUTO commit option (or) the CyU3PDmaChannelCommitBuffer() API is used to commit the data to the host.

          - Also, let us know what is the error code received on the Control Center during the failure.

           

          Best regards,

          Srinath S

          • 2. Re: Xferdata() fail on bulkin endpoint
            zqli_4003376

            - Also, ensure that the data is committed from the device to the host. In case you are using FX2LP, either the AUTO commit option (or) EPxBCH:L register loading commits the data to the host. In case you are using FX3, either the AUTO commit option (or) the CyU3PDmaChannelCommitBuffer() API is used to commit the data to the host

            [ZQ] I used FX3 with AUTO commit.

             

            - Also, let us know what is the error code received on the Control Center during the failure

            [ZQ] How to find error code on Control Center? And Control Center worked well, although my code return fail.

            • 3. Re: Xferdata() fail on bulkin endpoint
              zqli_4003376

              And more, I didn't find code sample for xferdata() useage in C++.

              Could you share some code example?

              • 4. Re: Xferdata() fail on bulkin endpoint
                SrinathS_16

                Hello,

                 

                - Please find example host application using C++ from the below path after the installation of FX3 SDK.

                C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\streamer.

                - If possible, kindly, post code snippets from your application corresponding to the XferData() API.

                 

                Best regards,

                Srinath S

                • 5. Re: Xferdata() fail on bulkin endpoint
                  zqli_4003376

                  Hi,

                  I found BeginDataXfer()/WaitForXfer()/FinishDataXfer() API in streamer project, but not xferdata().

                  Below is my code snippets:

                   

                  UCHAR data[16384] = {0};

                  UCHAT indata[16384] = {0};

                   

                  ......//some data stuff code

                   

                  if (!instance->m_pOpenDevice->BulkOutEndPt->XferData(data, outlen))
                    {
                     //instance->m_pEPBulkOut->Reset();
                     instance->m_pOpenDevice->BulkOutEndPt->Abort();
                     return false;
                    }


                    int revCount = 4;
                    while (revCount>0)
                    {
                     if (!instance->m_pOpenDevice->BulkInEndPt->XferData(indata, inlen))
                     {
                      instance->m_pOpenDevice->BulkInEndPt->Abort();
                      revCount--;
                      Sleep(20);
                      continue;
                     }
                     else
                      break;
                    }
                    if (revCount == 0)
                    {
                     return false;
                    }

                  • 6. Re: Xferdata() fail on bulkin endpoint
                    SrinathS_16

                    Hello ZQ,

                     

                    - Please find the attached project which performs a data transfer with the OUT/IN endpoint on the device. It has to be noted that BulkOutEndPt/BulkInEndPt identifies the first OUT/IN endpoint that enumerates on the device. The XferData API has been used to write data and read back the data from the OUT and IN endpoints respectively. This utility was tested on the USBBulkLoopAuto example that comes with the FX3 SDK. Kindly, test it at your end and let me know if you have further queries.

                     

                    Best regards,

                    Srinath S