CYUSB slower than ezusb

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

cross mob
Anonymous
Not applicable

I have a device with ezusb fx2 and I controlled the device using ezusb driver version 1.30 I moved to cyUSB driver version 3.4.7.0 but the communication with device is slower.

   

With old driver, with a fix hardware configuration, I am able to reach 30Mb/s of data trasfer, simply upgrading the driver to the cyUSB I only reach 15Mb/s.

   

I don't use the cypress library, I use directly the driver, below a detail of the code I use in both cases, obviously I cannot believe the new driver is slower than the old, so what I am doing wrong?

   

Thanks in advance for your support.

   

Alberto

   

 

   

 

   
#define MAX_BLT_SIZE    (60*1024)          BOOLEAN bResult;         ULONG nBytes, totBytes = 0, lun;         int np, i, resto;#ifdef NEWDRIVER // cyUSB.sys  SINGLE_TRANSFER singleTransfer;#else BULK_TRANSFER_CONTROL bulkControl;         bulkControl.pipeNum = 2;#endif        np = length / MAX_BLT_SIZE;         resto = length - np * MAX_BLT_SIZE;         if( resto > 0 ) np++;           for( i = 0; i < np; i++ ) {                   if( i == np - 1 ) lun = resto;                 else lun = MAX_BLT_SIZE;#ifndef NEWDRIVER // exUSB.sys V. 1.3                 bResult = DeviceIoControl(handle,                       IOCTL_EZUSB_BULK_READ,                       &bulkControl,                       sizeof( BULK_TRANSFER_CONTROL ),                       buffer + i*MAX_BLT_SIZE,                       lun,                       &nBytes,                       NULL                       );  #else // cyUSB.sys version 3.4.7   memset( &singleTransfer, 0, sizeof( singleTransfer));  singleTransfer.ucEndpointAddress= 0x86;   bResult= DeviceIoControl (handle,   IOCTL_ADAPT_SEND_NON_EP0_DIRECT,   &singleTransfer, sizeof( singleTransfer),   buffer + i*MAX_BLT_SIZE, lun,   &nBytes, NULL);#endif        if( bResult == 0 ) break;         totBytes += nBytes;         if( nBytes < lun ) break;         }           if( bResult )                 return totBytes;         else {                 DWORD ErrorCode = GetLastError();                 return -(LONG)ErrorCode;         }
0 Likes
2 Replies
Anonymous
Not applicable

Hi all,

   

I found the solution, it was the transfer size of the endpoint, I increased the size (using IOCTL_ADAPT_SET_TRANSFER_SIZE) and now I am able to read faster as with the old driver. Probably the cyUSB.sys by default has a smaller trasfer size than the old ezusb.sys.

   

Cheers,

   

Alberto

0 Likes
Anonymous
Not applicable

Hi,

   

Thanks for sharing the fix 

   

-PRJI

0 Likes