Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > FX2 Using Bulk, how to make it faster?

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



FX2 Using Bulk, how to make it faster?
Moderator:
RSKV

Post Reply
Follow this topic



FX2 Using Bulk, how to make it faster?

ShakesBeer posted on 27 Apr 2013 1:10 PM PST

1 Forum Post

 I wrote simple code, wich uses Bulk transfer.

Now it makes out transfer, and after transfers in, using the standart bulkloop.hex.

Made it on C++, used thread:

//---------------------------------------------------------------------------

class WriteAndReadThread : public TThread

{

private:

         void __fastcall Printing();

protected:

        void __fastcall Execute();    

public:

        __fastcall WriteAndReadThread(bool CreateSuspended); 

};

//---------------------------------------------------------------------------

WriteAndReadThread *writereader;  

//---------------------------------------------------------------------------

//конструктор потока WriteAndReadThread, по умолчанию пустой

__fastcall WriteAndReadThread::WriteAndReadThread(bool CreateSuspended) : TThread(CreateSuspended)

{}

//---------------------------------------------------------------------------

void __fastcall WriteAndReadThread::Execute()

{

 AnsiString stryng = Form1->Edit1->Text.c_str();

 outBuf=new char[stryng.Length()+1];

 strcpy(outBuf,stryng.c_str());

 length = stryng.Length()+1;

 //length = strlen(buffer);

 while(!Terminated)

  {

   outOvLap.hEvent = CreateEvent(NULL, false, false, "CYUSB_OUT");

   UCHAR *outContext;

   outContext = USBDevice->BulkOutEndPt->BeginDataXfer(outBuf, length, &outOvLap);   

   USBDevice->BulkOutEndPt->WaitForXfer(&outOvLap,100);            

   succesOut = USBDevice->BulkOutEndPt->FinishDataXfer(outBuf, length, &outOvLap,outContext); 

   if(!succesOut)

    {

     writereader->Terminate();         

     if(drawer)drawer->Terminate();

     Form1->SpeedButton1->Caption = "Begin transfer";

     Form1->SpeedButton1->Down = false;

     Form1->Memo1->Lines->Add("Sending error!");

    }

   CloseHandle(outOvLap.hEvent);

   inOvLap.hEvent = CreateEvent(NULL, false, false, "CYUSB_IN");

   UCHAR *inContext = USBDevice->BulkInEndPt->BeginDataXfer(inBuf, length, &inOvLap);

   USBDevice->BulkInEndPt->WaitForXfer(&inOvLap,100);

   succesIn = USBDevice->BulkInEndPt->FinishDataXfer(inBuf, length, &inOvLap,inContext); 

   if(!succesIn)  

    {

     writereader->Terminate();       

     if(drawer)drawer->Terminate();

     Form1->SpeedButton1->Caption = "Begin transfer";

     Form1->SpeedButton1->Down = false;

     Form1->Memo1->Lines->Add("Recieving error!");

    }

   Synchronize(Printing);

   CloseHandle(inOvLap.hEvent);

  }

 

The speed for in transfer is realy slow.  If I'll make the only IN transfer it will be not higther than 1 Mbyte per second.

Using the CyAPI how can I make with the speed 12 Mbyte per sec?




Re: FX2 Using Bulk, how to make it faster?

aasi posted on 28 Apr 2013 04:26 PM PST
Cypress Employee
1090 Forum Posts

Is the device connected as a full speed or high speed device?
Have you tried using streamer to measure the speed i.e. start one streamer stream to the out endpoint then start another streamer are receive from the IN endpoint?
Regards,
Anand
 






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