Page 1 of 1

uhci port reset

Posted: Fri Mar 29, 2013 6:39 am
by Sauro
HI,
I have a strange problem with a usb device
These days I was writing a driver for the full/low speed devices. (UHCI)
I own 10 devices, all work fine except for one device, which shows problems when I do a port reset. I use the classic sequence:
Wait the device is connected
Wait 400ms (Debounce for my USB Bluetooth device)
Port Reset 10ms
Recovery 10ms
Enable port.
Get Descriptor and so on ...
Ok, this sequence is perfect with all the devices, but one in particular (USB Mass Storage) only works if I do not do a Port Reset.
If I do a port reset, the device dies and I do not know how to resurrect :-)
This device has a red LED, which turns off after a port reset and the device no longer works.
Without a port reset, the device works perfectly.
Any ideas ?

Note:
Before answering, some prefaces.
I tried different timings, the ones I posted are only general.
I have already searched this forum other similar post, followed the suggestions and so on .., without any appreciable result.
I suspect that there is another way to reset the ports ( or not reset the port at all),
seems that the BIOS and Windows knows very well how to do it

Re: uhci port reset

Posted: Fri Mar 29, 2013 10:03 am
by TomT
After the port reset I do "Get Device Descriptor" requesting 8 bytes using endpoint=0
The command phase passes
The data phase may fail occasionally
Then the status phase will fail also
So
I just start over and issued the command again for Get Device Descriptor and it will always pass the second time.
I use usb flash drives rated 2.0

Also Im just curious what device is it and is rated usb 2.0 or 3.0 and can you gives us some more specifics on your device. Also what is your definition of "device dies". Does the command phase of Get Device Descriptor pass ? My flash drives have led's but they dont blink at all until I issue a read10 or write10 command. I know Linux must pound the device continuously with some kind of "keep alive" command but I don't do that and haven't found the need.

Have you tried waiting longer before port reset. Some devices seem to need more time to "settle out" after boot up before running the init sequence.

TomT
http://code.google.com/p/tatos/

Re: uhci port reset

Posted: Fri Mar 29, 2013 10:43 am
by Sauro
Thanks for your reply :D
The Device is a USB 2.0 Mass Storage 4GB ( Pen Drive)
The device does not respond to any solicitation, DIES [-o<
I tried your code (Tatos), it does not work.
This device only works if you do not touch the port reset bit. #-o
Before reset , I waited up to 10 seconds :roll:
Now I started to disassemble my BIOS to see how it initializes the USB devices.
After the port reset I do "Get Device Descriptor" requesting 8 bytes using endpoint=0
I tried up to 128, get device descriptor requesting...
NOTHING
The port is Enabled ALL OK , but the device don't respond :evil:

Re: uhci port reset

Posted: Fri Mar 29, 2013 11:31 am
by TomT
What is the make/model of your pen drive ?

Re: uhci port reset

Posted: Fri Mar 29, 2013 12:35 pm
by Sauro
This is the device Descriptor:

Code: Select all

0 bLength		12h  
1 bDescriptorType	01h Device 
2 bcdUSB		0200h USB Spec 2.0 
4 bDeviceClass		00h Class info in Ifc Descriptors 
5 bDeviceSubClass	00h  
6 bDeviceProtocol	00h  
7 bMaxPacketSize0	64 bytes 
8 idVendor		19B6h Infotech Logistic, LLC 
10 idProduct		4096h  
12 bcdDevice		0100h 1.00 
14 iManufacturer	01h "USBest Technology" 
15 iProduct		02h "USB Mass Storage Device" 
16 iSerialNumber	03h "00000000000162" 
17 bNumConfigurations	01h 
Top of the device is written Maxell :)

Re: uhci port reset

Posted: Fri Mar 29, 2013 4:08 pm
by pikasoo
Hi,
mabe you already tryed it, but have you try to hold the reset bit longer than 10ms?
i cant find where i read it, but i belive you have to maintain it at least 60ms(some device take time to reset)... on my code i keep it for 80ms(to be safe) and the usb mass storage work fine for me...

Re: uhci port reset

Posted: Sat Mar 30, 2013 11:49 am
by Sauro
Ok
Now it works :P
First I did a reset with the Host Controller in Stopped State,
Now doing a reset with the Host Controller in Run State, it works :?