Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > CYUSB slower than ezusb

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



CYUSB slower than ezusb
Moderator:
RSKV

Post Reply
Follow this topic



CYUSB slower than ezusb

lcolombini posted on 21 Mar 2013 4:56 AM PST
Member
2 Forum Posts

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



Re: CYUSB slower than ezusb

lcolombini posted on 21 Mar 2013 10:30 AM PST
Member
2 Forum Posts

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



Re: CYUSB slower than ezusb

PRJI posted on 21 Mar 2013 08:39 PM PST
Cypress Employee
333 Forum Posts

Hi,

Thanks for sharing the fix 

-PRJI






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20