2 Replies Latest reply on Mar 21, 2013 10:39 PM by prajith.cheerakkoda

    CYUSB slower than ezusb


      I have a device with ezusb fx2 and I controlled the device using ezusb driver version 1.30 I moved to cyUSB driver version 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.







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