Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > 68013a seems unstable when unplug flash disk without safely removed

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



68013a seems unstable when unplug flash disk without safely removed
Moderator:
RSKV

Post Reply
Follow this topic



68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 06 Nov 2011 6:30 PM PST
Member
9 Forum Posts

Hi, our company develped a printer with 68013A100AXC in slavefifo mode,it runned perfectly but unpluged flash disk without removed it safely in the windows XP. Some data seems lost, so the printed picture is wrong. When the flash disk were removed safely in the operation system before unpluged, there were not any problem. Anyone have had the same problem or what can I do to improve the satblity?

regards

hujianhua




Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 08 Nov 2011 01:15 AM PST
Cypress Employee
428 Forum Posts

 Hello,

 

Do you mean to say that as you issue the 'Print" command and before the printing task is complete, you plug out the device and then the picture is distorted? That is obvious since the data has not reached through fully. In order to increase the stability you can increase the data rate by using a deeper buffering. Please check out that !!

 

Regards,

Gayathri 



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 08 Nov 2011 05:26 PM PST
Member
9 Forum Posts

Thanks for your replay, Gayathri ,but the file I want to print is not int the flash disk, it is in the computer disk, the flash disk is not related to my print job. I found yesterday that when plug out the flash disk(nothing to do with my print job, just a flash disk) without safely removed, the bulk transfer with the DeviceIoControl function returned error. So I didn't know how much data had been sent and how much had been lost.  Everytime I sent 16KB into the general driver of 68013. Would you give me some more advices, thanks very much. 



Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 09 Nov 2011 11:48 PM PST
Cypress Employee
428 Forum Posts

 Hello,

 

So, the case is that as you plug out a flash disk, which is no way related to printer application, the data flow to the printer is getting affected. That is really strange. Can you check and let me know wjat is the error being returned? I believe you are communicating directly to CyUSB.sys driver without using CyUSB.dll. If so, you can use Marshal.GetLastWin32Error() method to get the error code. Please have a look at for ore information:

http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getlastwin32error.aspx

http://msdn.microsoft.com/en-us/library/ms681381.aspx

 

Also, it would be useful if you can get a trace of the USB traffic using any Analyzer like CATC/Ellysis. If so, please provide us the trace.

 

Regards,

Gayathri



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 09 Nov 2011 06:07 AM PST
Member
9 Forum Posts

hi,  I tried GetLastError function in my print program and printed it using FormatMessge function. The result was "The operation completed successfully". It's weird. And by using Bus Hound to check the data, I found 68013 returned an error when I unpluged the flash disk. Today I tried sending 512 Byte ererytime, and sent again when it failed ,it seemed work OK ,though it still returned  error when I unplug the flash disk. I feel that when I send a packet more than 512 to generic driver, the driver will sent the data  to 68013 several times for me at 512 a packet, but when I unplug the flash disk without remove it safely, the system  find a error and interrupt the driver, so some packets have been sent ,some lost, and return an error. When sending  512 it  succeed or failed, won't lost data in the driver. I tried using CYAPI, the result was the same. I dont know if it is the dirver's probelm or system.

At some high end computer , it had't the problem, but at low end computer the problem is serious.

regards,

hujianhua

 



Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 10 Nov 2011 10:50 PM PST
Cypress Employee
428 Forum Posts

 Hi,

 

Can you please take screenshots of the USB trace, for both cases, when you are sending 512 Bytes everytime and 16kB everytime.

 

Regards,

Gayathri



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 10 Nov 2011 02:07 AM PST
Member
9 Forum Posts

hi, the 512 case refresh so fast that I couldn't catch it,the 16K case is in the file attached.Hope for your advices. Thanks.

regards

hujianhua



Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 10 Nov 2011 05:52 AM PST
Cypress Employee
428 Forum Posts

Hi,

 

The screenshot is of little use. I think it would be good if you can send over the actual trace file. I downloaded Bus Hound 6.01 limited version. If that won't be enough, please point to me the location from which I download the Bus Hound s/w. I would like to look at the USB packets.

Also, I did not understand what you meant by '512 case refresh so fast'. Can't you start recording the traffic in the software, and then start sending the 512 Byte traffic? Please clarify me if I am wrong.

 

Regards,

Gayathri



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 10 Nov 2011 08:17 PM PST
Member
9 Forum Posts

hi,

It seems that the bus hound can only record 2076KB. I couldn't catch the error in the 512 case because it overides the past record so fast. The two files below are the records of 512 and 16K. Thanks.

regards,

hujianhua



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 10 Nov 2011 08:20 PM PST
Member
9 Forum Posts


Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 11 Nov 2011 12:45 AM PST
Cypress Employee
428 Forum Posts

 Hello,

 

My understanding from one of your previous comments is that: When you are sending data to printer as 512Bytes/16kB everytime, in both cases unplugging Flash drive is interrupting this data transfer and thus causing drop in some packets, and thus error. But since the 16kB packets are bigger, the loss is profound and thus the printed picture is getting distorted. In case 512 Bytes, the packets being smaller, loss is not that notable in the printed picture. Please correct me if I am wrong.

Today I was trying to get familiar with the Bus Hound captures. I would like to know whether the 'data' field in the Bus hound capture is in Big/little endian format. I was wondering, because, I found that USB STATUS CODE = 0x C0 00 00 11 is same as USB_XACT_ERROR. But I could not find any explanation for the USB STATUS CODE = 0x 11 00 00 C0 so far. I am looking about this further. But I just wanted to check with you in case you know, about the endianness of the 'data' field in Bus hound.

 

Regards,

Gayathri



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 11 Nov 2011 06:09 AM PST
Member
9 Forum Posts

hi,

In my opinion ,since the usb 2.0 sending a packet as 512 byte, when I sent a packet as 512, it sent it successfully or didn't send at all. So computer didn't send the data  when I got an error, I resent this packet again and it was OK. I had a test that I didn't send the packet again when got an error, the image was wrong. But when 16K a packet , the computer may have had sent some packets when being interrupt and return an error. I had also tested resending at 16K a packet, the image wasn't right.

I think bus hound is little endian. I had ever sent 0x90 03, it showed 03 90.

thanks.

regards,

hujianhua



Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 14 Nov 2011 04:47 AM PST
Cypress Employee
428 Forum Posts

 Hello,

 

I think since the same host controller is handling both the devices, when you are un-plugging the flash drive without safely removing, error generated due to the Flash drive is causing the interruption in the transfers to the FX2LP. I don't think it has got anything to do with CyUSB.sys driver. If it was possible to capture the error of 512Byte case, then we could have confirmed whether the packets are being re-sent or not.

I think, it would be always good to do 'Safely remove' and un-plug the device. If you are keen on unplugging it otherwise or to further debug into the issue, we will have to analyze the traffic more deeply. For that you may have to create a case so that one of our engineers can take a look at this and work closely with you. You may create the case at http://www.cypress.com/ if so.

 

Regards,

Gyaathri



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 14 Nov 2011 06:27 AM PST
Member
9 Forum Posts

Thanks. I'll do more tests to check if there is any method to slove the problem.

regards,

hujianhua



Re: 68013a seems unstable when unplug flash disk without safely removed

Gayathri posted on 15 Nov 2011 05:03 AM PST
Cypress Employee
428 Forum Posts

 Hello,

 

Please feel free to open a case if you think you need help. We are always glad to help you out. If you find anything notable, please do post it here, so that others can benefi from the same.

 

Regards,

Gayathri



Re: 68013a seems unstable when unplug flash disk without safely removed

bobthebender posted on 19 Nov 2011 11:20 PM PST
Member
4 Forum Posts

 

 This occurs with many devices and hubs.

Devices MUST be removed safely if they are mounted, in many cases it is the action of removing the device that causes some hubs to reset and try to re-numerate the device chain.

I can reliably duplicate this  on a number of  'asian' made hubs, it even causes my IPod to think it ha been disconnected & re-connected.



Re: 68013a seems unstable when unplug flash disk without safely removed

hujianhua posted on 24 Nov 2011 04:48 PM PST
Member
9 Forum Posts

The low-cost hubs are really troublesome .

regards,

hujianhua






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: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20