Interfacing with USB as a Host

Thread Starter

AgentSmithers

Joined Jan 14, 2011
67
Hey Everyone! I am currently working on creating a USB Host project with the ESP8266 and have been reading a lot up on USB specifications. One thing I am having trouble finding is if the USB device connects with a low-speed connection then is the baud rate set to 1.5Mbps and then if connected at Highspeed to 12Mbps just to start sending my handshake and control packets?
 

Thread Starter

AgentSmithers

Joined Jan 14, 2011
67
Interesting, I've worked with a few protocols. So USB transmitters like keyboards and flashdrives send these first 8/32bit sync packets at their own custom rate and USB server then see's the steady stream and adjust to that baud rate correct? Is there a range or specific recommended baud rate values as long as you don't go over the 1.2/12Mbps cap?
 

Wolframore

Joined Jan 21, 2019
1,243
I'm not an expert, the information appears to be available if you dig in... I would start looking at datasheets and the USB protocol.

USB 2.0 speed negotiation
USB 2.0 devices use a special protocol during reset, called chirping, to negotiate the high bandwidth mode with the host/hub. A device that is USB 2.0 High Speed capable first connects as a Full Speed device (D+ pulled high), but upon receiving a USB RESET (both D+ and D− driven LOW by host for 10 to 20 ms) it pulls the D− line high, known as chirp K. This indicates to the host that the device is high bandwidth. If the host/hub is also HS capable, it chirps (returns alternating J and K states on D− and D+ lines) letting the device know that the hub operates at high bandwidth. The device has to receive at least three sets of KJ chirps before it changes to high bandwidth terminations and begins high bandwidth signaling. Because USB 3.0 uses wiring separate and additional to that used by USB 2.0 and USB 1.x, such bandwidth negotiation is not required.

Clock tolerance is 480.00±0.24 Mbit/s, 12.00±0.03 Mbit/s, and 1.50±0.18 Mbit/s.

Though high bandwidth devices are commonly referred to as "USB 2.0" and advertised as "up to 480 Mbit/s," not all USB 2.0 devices are high bandwidth. The USB-IF certifies devices and provides licenses to use special marketing logos for either "basic bandwidth" (low and full) or high bandwidth after passing a compliance test and paying a licensing fee. All devices are tested according to the latest specification, so recently compliant low bandwidth devices are also 2.0 devices.
 
Last edited:

Thread Starter

AgentSmithers

Joined Jan 14, 2011
67
Thanks Wolframore, Ive been reading through the website
http://www.usbmadesimple.co.uk/ums_6.htm
and
https://www.beyondlogic.org/usbnutshell/usb2.shtml
And I did find that it reflects chirping for USB 2.0 but never says anything about 1.x. Maybe its always insulated. From your post, I gather the baud rate needs to be set statically to 1572864 for 1.5 Mbit/Mbps±0.18 Mbit/s and for 12Mbps 12582912±0.03 Mbit/s(Depending on the pullup-setup with D+/D-) then just bitbang out the communication from there (Taking into account the USB protocol) correct?.
I will only be dealing with USB 1.x in this case.
 

Wolframore

Joined Jan 21, 2019
1,243
I believe that USB 1.X sets default to 1.5 Mbits then uses the sync field to determine the bitrate... I highlighted the above for reference to USB 1.X.
 
Top