Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > how to transfer large files with fx2lp

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



how to transfer large files with fx2lp
Moderator:
RSKV

Post Reply
Follow this topic



how to transfer large files with fx2lp

huoshanqiu posted on 16 Apr 2012 2:04 AM PST
Member
4 Forum Posts

Hi there,

 

I am trying to transfer large files(larger than 1MB) with fx2lp.  Actually, I just followed AN61345(Implementing an FX2LP™-FPGA Interface). It worked well on EZ-USB console, 512 bytes send to ep2, 512 bytes back to ep6.

 

Then I made a app with VC6. Divide the large file to 512 bytes packets, and transfer them via Xferdata() fuction. The code is

 

for(i=0;i<pcount;i++)

 

{

for(j=0;j<buf_size;j++){usb_i[j]=sig_i[buf_size*i+j];}

if(USBDevice->BulkOutEndPt)

i_finish=USBDevice->BulkOutEndPt->XferData(usb_i,buf_size);

if(USBDevice->BulkInEndPt)

o_finish=USBDevice->BulkInEndPt->XferData(usb_o,buf_size);

for(j=0;j<buf_size;j++) {sig_o[buf_size*i+j]=usb_o[j];}

}

 

When the files are small(<20kB), it works well. Every step ep6 become empty when the data is read by host.

 

If the file is larger, as the process continus, ep6 will not be empty sometime and all the followed data is error code(always CD).

 

I am using cy3684_kit_15, hope someone help me to find the reason or give some advice.

 

Thanks!

 




Re: how to transfer large files with fx2lp

PRJI posted on 18 Apr 2012 04:46 AM PST
Cypress Employee
333 Forum Posts

  Hi,

  Please take the trace of USB traffic(using USB traffic analyzers like CATC) and post it here so that we can have a look at it.

Thanks

Prajith




Re: how to transfer large files with fx2lp

huoshanqiu posted on 19 Apr 2012 10:59 PM PST
Member
4 Forum Posts

 Hi,

Thanks for your reply. Besides, what's a CATC? An instrument or some kind of software?

I just made a simple test:

 

LONG buf_size=512;

for(int i=0;i<100;i++)

{

o_finish=USBDevice->BulkOutEndPt->XferData(usb_i,buf_size);

i_finish=USBDevice->BulkInEndPt->XferData(usb_o,buf_size);

cout<<o_finish<<'\t'<<i_finish<<endl;

}

The output:

1 1

1 1

...

1 1

1 0

1 0

...

1 0

press any key...

 

The BulkIn XferData immediately failed. I think there are two possible reasons: (a)EP6 stalled; (b)EP6 do not have enough data. Is it right?

Then after the test above, I just do

i_finish=USBDevice->BulkInEndPt->XferData(usb_o,buf_size);

again. And it returns 1, the empty flag also changed.

So, can I say EP6 works well, the XferData() goes wrong?

I am try to start two new threads for BulkIn, one failed, start another, hope it worked.

 

Thanks again!



Re: how to transfer large files with fx2lp

huoshanqiu posted on 19 Apr 2012 09:01 PM PST
Member
4 Forum Posts

 Sorry guys,

I just changed a powersupply, and the problem solved...

Should find this at the very start...

 


Re: how to transfer large files with fx2lp

PRJI posted on 20 Apr 2012 11:29 PM PST
Cypress Employee
333 Forum Posts

 Coool  

Thanks for sharing the fix.






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