Independently control VBus and data connections on each port of the USBHub3+

2023 October 14

The USBHub3+ provides advanced control beyond basic on/off switches, allowing for precise USB customization.

The USBHub3+ can also independently enable and disable Voltage and Data:

  • Vbus
  • All Data
  • High Speed data (480 Mbps)
  • Super Speed data (5 Gbps)

We'll be working interactively using the Brainstem API in a Python console so you can see the results line-by-line. 

First, power on the hub and connect one of the host ports to your computer

All of the VBus LEDs on the front panel should be on. If you haven’t already, install the brainstem package (See the Quickstart Guide for more detail)


>>> !pip install brainstem --upgrade

Then import the brainstem library


>>> import brainstem

Create an instance of the USBHub3p called "hub"


>>> hub = brainstem.stem.USBHub3p()

Discover and connect to the hub


>>> hub.discoverAndConnect(brainstem.link.Spec.USB)
0

(A return value of 0 means no error)

Let's plug a SuperSpeed USB 3 device (in this case an iPad Pro with a USB3-to-C cable) into port 0.  A green LED should turn on next to port 0.

Let's check the port state:


>>> result=hub.usb.getPortState(0) 
>>> format(result.value, 'b') 
'100000000001000000001011'

Bits 0,1,3,12,23 are high.  Checking this table, we see:

  • Vbus enabled
  • USB2 data enabled
  • USB3 data enabled
  • USB3 device Attached
  • Device attached

Now let's disable Vbus while keeping the data connection on


>>> hub.usb.setPowerDisable(0)

Many devices will drop the data connection when Vbus is disabled and the hub data LED will be off as well

getPortState returns '1010', meaning

  • Vbus disabled
  • USB2 data enabled
  • USB3 data enabled

Re-enable Vbus:


>>> hub.usb.setPowerEnable(0)

The iPad Pro reconnected automatically, while the audio interface required an unplug-replug (or port disable / reenable) to make a data connection.

Let's turn off the data connection on port 0:


>>> hub.usb.setDataDisable(0)

The data LED is off, and Vbus is on.  (the device is charging, but has no data connection)

Reenable data:


>>> hub.usb.setDataEnable(0)

Not let's disable just SuperSpeed:


>>> hub.usb.setSuperSpeedDataDisable(0)

If your device supports both Super Speed and High speed, the data LED will switch to yellow indicating high speed connection.

getPortState returns '100000000000100000000011' meaning 

  • Vbus enabled
  • USB2 data enabled
  • USB2 device Attached
  • Device attached

Re-enable Super Speed:


>>> hub.usb.setSuperSpeedDataEnable(0)

The device may not reconnect until Vbus is toggled (by physically unplugging, disabling and re-enabling the port or just VBus)

We can also disable High Speed USB lines


>>> hub.usb.setHiSpeedDataDisable(0)

Super Speed devices should be unaffected, while High Speed devices will disconnect.

Re-enable High Speed lines:


>>> hub.usb.setHiSpeedDataEnable(0)


In conclusion, the USBHub3+ offers an impressive level of control over your USB connections that goes far beyond simple on and off switches. With the ability to independently enable or disable VBUS, data connections, high-speed, and super-speed connections for each port, you have the power to tailor your USB experience precisely to your needs.

This level of control is particularly valuable in scenarios where specific USB connections are essential, or when you need to troubleshoot and fine-tune your setup. The USBHub3+ truly empowers you to manage your USB devices with precision, ensuring they operate exactly as you intend.

Shop Now

 

What else could you do with USBHub3+?

 

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.