{{{#!html

  1. Universal Serial Bus (USB)
    1. Versions
    2. Host Controllers
    3. USB Speeds
    4. USB Transfer types
    5. USB Device Classes
    6. Human Interface Device
    7. Vendor Specific
    8. Gateworks USB devices
    9. USB Steering
    10. USB Reset
      1. VBUS reset
      2. Soft reset via sysfs bind/unbind (re-enumerate)
      3. Soft reset via ioctl

Universal Serial Bus (USB)

Universal Serial Bus (USB) is an industry standard developed in the mid-90's that defines cables, connectors and communication protocols used in a bus between computers and peripherals.

References:

Versions

Host Controllers

The following types of USB host controllers exist:

USB Speeds

The following is a set of supported speeds per USB specification:

USB Transfer types

There are four types of transfers in USB:

USB Device Classes

USB has a list of recognized and approved USB device classes in order to simplify driver development. The most common device classes are:

Human Interface Device

Often vendors choose HID device class to allow control via userspace applications without needing a OS specific driver (as all modern OS's have an HID driver).

The HIDAPI (open-source and cross-platform Linux/Windows/MacOS) provides simple USB HID enumeration, read and write functions.

The HID device class uses HID reports to describe details about the data input and output a device supports. The sub class can be 'Generic HID' and the report type can be 'Vendor Defined' which makes it generic. The maximum report size is 64B.

Vendor Specific

Vendors sometimes choose to implement a Vendor specific device which has an undefined class.

The libusb (open-source and cross-platform Linux/Windows/MacOS) can be used for generic USB communication. Vendor specific commands can be implemented.

Gateworks USB devices

In an effort to define these options available to developers, Gateworks has created the following table with the fields as follows:

In all cases the miniPCIe slots get their VBUS directly from the board power rail, which has no power control.

Gateworks USB device Table:

Family SBC USB Port Ref Reset Bus-Device[.Port] Bus Steering
Ventana GW51xx Front Panel OTG J20 Soft/VBUS 1-1
miniPCIe USB EHCI J6 Soft 2-1
GW52xx Front Panel OTG J15 Soft/VBUS 1-1 gpio2 low (default)
Bot Right miniPCIe EHCI J7 Soft 2-1
Bot Left miniPCIe OTG J8 Soft 2-1 gpio2 high
GW53xx Front Panel OTG J20 Soft/VBUS 1-1
Front Panel EHCI J18 Soft/VBUS 2-1.1
Bot Left miniPCIe EHCI J9 Soft 2-1.2
Bot Center miniPCIe EHCI J8 Soft 2-1.3
Bot Right miniPCIe EHCI J6 Soft 2-1.4
GW54xx Front Panel OTG J23 Soft/VBUS 1-1
Bot Right miniPCIe EHCI J6 Soft 2-1.1
Top Right miniPCIe EHCI J9 Soft 2-1.2
Top Left miniPCIe EHCI J7 Soft 2-1.3
Front Panel EHCI J21 Soft/VBUS 2-1.4
GW551x Adapter Board OTG J3 (J9 on Adapter) Soft 1-1
Bot miniPCIe EHCI J2 Soft 2-1
GW552x Bot Left miniPCIe EHCI J6 Soft 1-1.1
Bot Right miniPCIe EHCI J5 Soft 1-1.2
Front Panel EHCI J10 (Top) Soft/VBUS 1-1.3
Front Panel EHCI J10 (Bot) Soft/VBUS 1-1.4
GW553x Front Panel OTG J8 Soft/VBUS 1-1
miniPCIe EHCI J5 Soft 2-1
Laguna GW2380 MiniPCIe EHCI J5 Soft 1-1
GW2382 Front Panel EHCI J4 Soft/VBUS (gpio9) 1-1 gpio10 high (default)
MiniPCIe EHCI J5 Soft 1-1 gpio10 low
GW2383 Front Panel OTG J4 Soft/VBUS 1-1
MiniPCIe EHCI J6 Soft 1-2
GW2387 Front Panel OTG J12 (Top) Soft/VBUS (gpio6) 1-1
Front Panel EHCI J12 (Bot) Soft/VBUS (gpio6) 2-1 gpio5 low (default)
MiniPCI EHCI J5 (Bot) Soft 2-1 gpio5 high
GW2388 Front Panel OTG J19 (Top) Soft/VBUS (gpio6) 1-1 (loading option)(1)
Front Panel EHCI J19 (Bot) Soft/VBUS (gpio6) 2-1 (loading option)(1)
MiniPCI EHCI (1) J4 (Bot) Soft 2-1 (resistor loading option)(1)
GW2391 Front Panel OTG J14 (Top) Soft/VBUS (gpio6) 1-1 gpio5 low (default)
Front Panel EHCI J14 (Bot) Soft/VBUS (gpio6) 2-1 gpio7 low (default)
MiniPCIe OTG J4 (Bot) Soft 1-1 gpio5 high
MiniPCIe EHCI J3 (Top) Soft 2-1 gpio7 high
Cambria GW2350 Front Panel EHCI J9 (Top) Soft/VBUS 1-1
Front Panel EHCI J9 (Bot) Soft/VBUS 2-1
MiniPCI EHCI (1) J4 Soft 2-1 (resistor loading option)(1)
GW2358 Front Panel EHCI J16 (Top) Soft/VBUS 1-1
Front Panel EHCI J16 (Bot) Soft/VBUS 2-1
MiniPCI EHCI (1) J8 Soft 2-1 (resistor loading option)(1)
Avila GW2348-SP107 Front Panel EHCI J18 (Top) Soft/VBUS 1-1
Front Panel EHCI J18 (Bot) Soft/VBUS 2-1
MiniPCI EHCI (1) J4 Soft 2-1 (resistor loading option)(1)
  1. This is a loading option available on specials - contact ​sales@…
    • Cambria GW2350 (Bottom MiniPCI socket J4)
      • R164, R163 = Load to route USB to MiniPCI connector J8 (bottom slot)
    • Cambria GW2358 (Bottom MiniPCI socket J8)
      • R146, R153 = Load to route USB to MiniPCI connector J8 (bottom slot)
      • R138, R140 = Load to route USB to frontpanel connector J16 (top USB port)
    • Laguna GW2388-D+ (Bottom MiniPCI socket J4)
      • R240, R244 = Load to route USB to MiniPCI connector J4 (bottom slot) (default on GW2388-4)
      • R241, R242 = Load to route USB to frontpanel connector J19 (top USB port) (default on GW2388-SP208, SP212 and SP213 w/front panel USB loaded)

USB Steering

Some boards allow USB to be steered via a software controlled gpio. Refer to the 'bus steering' column for details which show which gpio to use, what the default is set to (via bootloader), and where it can be steered to. Typically a bus may be steerable between a front-panel connector and a miniPCIe socket in which case the front-panel is always the default configured by the bootloader. You can change the steering at run-time if you whish which would be like physically removing a USB device from the bus and adding another (re-enumerates).

Examples:

USB Reset

The best way to reset a USB device is to 'hot plug' the device by physically removing and reinserting it. However this is not typically possible and there are other options.

Note that BUS Steering can sometimes be a useful alternative to resetting a device as it forces a re-enumeration of the device.

VBUS reset

The next best thing to physically removing and re-inserting a USB device is to toggle power to that device. While this is not possible on the USB bus routed to miniPCIe sockets (which run off an always 3.3V power rail) this is possible on:

Ports provided by a USB OTG controller ('OTG' in USB Port name) which support host mode can have their VBUS reset by unbinding and rebinding the host controller via sysfs:

Ports provided by a USB Hub's (will have a '.<port>' in their bus-device.port entry in the table above) with over-current/fault detection such as those found on a GW530x/GW540x can have their VBUS reset by unbinding their upstream bus-dev from the USB bus:

echo 2-1 > /sys/bus/usb/drivers/usb/unbind
sleep 1
echo 2-1 > /sys/bus/usb/drivers/usb/bind

Ports with GPIO controlled VBUS such as the Laguna boards can be reset by turning them on/off via gpio control:

Refer to the USB device table above for the bus-dev and/or VBUS capabilities per board.

Soft reset via sysfs bind/unbind (re-enumerate)

In some scenarios (ie Mini-PCIe modem) having command line options to reset these devices via sysfs is preferable and can be found via modern kernel drivers. Refer to the USB Device Table above for the bus-device.port reference for your board/port.

Note that commands targeting a hub cause a soft reset for all child devices which include the front panel and any pcie ports with "usb" on the silk screen. VBUS is only brought down on the front panel port(s) connected to the internal hub.

Examples:

Soft reset via ioctl

There are also ioctls that can accomplish the same results programmaticlly and in some cases give even finer control than the above table. An example of a simple program that uses some of these ioctls is the usbreset command (present in OpenWrt):

Further information regarding these ioctls can be found throughout the Linux source documentation.

}}}