68013a seems unstable when unplug flash disk without safely removed

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
1 Solution
Anonymous
Not applicable

 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 

View solution in original post

0 Likes
16 Replies
Anonymous
Not applicable

 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 

0 Likes
Anonymous
Not applicable

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. 

0 Likes
Anonymous
Not applicable

 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.asp...

   

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

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

 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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

 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

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

 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

0 Likes
Anonymous
Not applicable

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

   

regards,

   

hujianhua

0 Likes
Anonymous
Not applicable

 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

0 Likes
Anonymous
Not applicable

 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.

0 Likes
Anonymous
Not applicable

The low-cost hubs are really troublesome .

   

regards,

   

hujianhua

0 Likes