2 Replies Latest reply on Sep 8, 2016 12:38 AM by hxf_fly_1858941

    How to receive residual data in FX3 cyusb3014?

    hxf_fly_1858941

      Hi, dear friends,

         

         I met a problem in FX3 to receive residual data in FX3:in order to achieve high speed, I set a large transfer data length for XferData() function, such as 1024*1024, but at the end of the data transfer, there will be a little amount of data smaller than 1024*1024.So when XferData() time out,I can't receive the data tail .

         

      In addition,I want to know how many bytes in the endpoint buffer before XferData ? so I can set Xferdata second parameter with this.

         

      here is part of my code:

         


       BYTE * pContext=NULL;
       long   nBulkLen = 1024*1024;
       pContext=pBulkEpIn->BeginDataXfer(pBulkBuf, nBulkLen, &oRdOvLap);
      if(!pBulkEpIn->WaitForXfer(&oRdOvLap, 1000))
      {
          pBulkEpIn->Abort();
          WaitForSingleObject(oRdOvLap.hEvent,INFINITE);
          nRetCode=0x01;
          TRACE("time out!\n");
          //break;
      }

      bool recvRet = pBulkEpIn->FinishDataXfer(pBulkBuf, nBulkLen, &oRdOvLap, pContext);

      //bool recvRet = pBulkEpIn->XferData(pBulkBuf,nBulkLen);
      TRACE("the actual receive length = %d ,recvRet = %d\n",nBulkLen,recvRet);

         

         Does anybody know how to solve this problem?Thank you very much and best wishes.