Xferdata() fail on bulkin endpoint

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

cross mob
zqli_4003376
Level 1
Level 1

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.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

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

View solution in original post

0 Likes
6 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

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

0 Likes

- 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.

0 Likes

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

Could you share some code example?

0 Likes

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

0 Likes

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;
  }

0 Likes
lock attach
Attachments are accessible only for community members.

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

0 Likes