Choose speed in USBHost_t36 library

Status
Not open for further replies.

rya

Member
Hi

I create the USB driver to communicate with the device accordantly detailed Paul’s description at this topic: https://forum.pjrc.com/threads/60414-USBHOST_t36-direct-write

It communicates with new generation of the device successfully. (The communication speed is equal 12Mb/s accordantly enumeration.cpp debug data)

However, the previous generation of the device has feature (bug?). It is capable to return different device descriptor which depended by communication speed. To correct work, I need device descriptor with bcdUSB = 0x100, but driver automatically choose higher speed and wrong device descriptor with bcdUSB = 0x200 is returned by device.

Is it possible to preventive decrease the speed to 1.5Mb/s in USBHost_t36 library to communicate with device which support higher speed?
If yes, how it could be done?

Any suggestions are appreciated.

Thank you
 
The USB host hardware in Teensy supports 3 speeds: 480, 12 and 1.5. By editing the code, you can disable the 480 speed, leaving 12 and 1.5.

But there is no way to disable 12 or otherwise force a USB device to run at 1.5, because of the way USB works...

During enumeration, each USB device tells the host what speed it supports. The original USB 1.0 & 1.1 spec defined only 12 and 1.5 speed. The device tells the host which speed it supports by a pullup resistor connected to one of the data pins. If the resistor is on the D+ pin, the device is designed to run at 12 Mbit. If the resistor is connected to the D- signal, it's a low speed 1.5 Mbit device. There is nothing the host can do to influence this speed choice. It depends entirely on which pin in the device has the 1.5K pullup resistor.

USB 2.0 added 480 Mbit speed, which is done with a resistor on the D+ pin as if the device is 12 Mbit speed, but then high bandwidth chirps are exchanged early in the enumeration process. You can control that from software. To disable 480 speed, edit ehci.cpp. Look for the line with "force 12 Mbit/sec".

https://github.com/PaulStoffregen/U...d38d88aaf214ec80e6cd66b6f2e76de/ehci.cpp#L267

Despite what the comment says, this won't cause a 1.5 device to run at 12, and there is no way (at least from the USB host side) to cause a 12 Mbit device to run at 1.5. All this does is disable the 480 Mbit speed. From the USB host side, you have absolutely no control over which data pin has the 1.5K resistor connected, so you just can't control the choice between 12 and 1.5 Mbit speed.
 
I am not sure.

It might help to know additional information, like is this a main type object or is it, one that is something like a HID device that uses the HID object (Or bluetooth object) to do the actual talking to the device? If at the device level, than maybe you can drive this at the ::claim method.

Than if you do process the claim, then do you do at at type=0 level (device level) or at the descriptor level (type == 1)?

If you are not doing at type==1 you might try it and reject the high speed one and accept the low speed one.

At least that would be my first guess.
 
Thank you Gentlemen for reply

Always learn new from the forum

Found here: https://www.beyondlogic.org/usbnutshell/usb2.shtml what Paul described
Will try to look hardware of the device.

Just curious: How the PC (USB-2.0 and Windows XP) received correct device descriptor with authentic driver. The PCAP in WireShark shows no any transaction before device descriptor request for which one receive “correct” response.

Thank you
 
Status
Not open for further replies.
Back
Top