USB System

API Documentation: [cpp] [python] [.NET] [LabVIEW]

The USBSystem class provides high level control of the lower level Port Entity


Upstream Control

The USBHub3c has the unique ability to designate any of its full featured (0-5) ports as the upstream connection. This is very useful for moving devices between hosts or testing dual role port functionality.

stem.hub.setUpstream() [cpp] [python] [NET] [LabVIEW]
stem.hub.getUpstream() [cpp] [python] [NET] [LabVIEW]

Enumeration Delay

Once a USB device is detected by the USBHub3c it is possible to delay its connection to an upstream host computer and subsequent enumeration on the USB bus. The enumeration delay can mitigate or eliminate host kernel instabilities by forcing devices to enumerate in slow succession, allowing a focus on validation of drivers and software. The enumeration delay is configured in milliseconds, representing the time delay between enabling each successive port. Enumeration delay is applied when the hub powers on or when a new upstream connection is made.

stem.hub.setEnumerationDelay() [cpp] [python] [NET] [LabVIEW]
stem.hub.getEnumerationDelay() [cpp] [python] [NET] [LabVIEW]

Power Behavior

Ports 0-5 of the USBHub3c are all capable of sourcing 100 watts pending the system has access to that amount of power. In most cases 500 Watts is not available and therefore the system has to be cleaver about how it allocates power. The method in which power is allocated across these ports is called the power behavior and it can be configured through

stem.hub.setPowerBehavior() [cpp] [python] [NET] [LabVIEW]
stem.hub.getPowerBehavior() [cpp] [python] [NET] [LabVIEW]

Some behaviors require additional configuration. In most cases this is a list of port numbers that define which ports should be prioritized for power allocation.

stem.hub.setPowerBehaviorConfig() [cpp] [python] [NET] [LabVIEW]
stem.hub.getPowerBehaviorConfig() [cpp] [python] [NET] [LabVIEW]

Data Behavior

Many devices are now capable of being Dual Role Ports (DRP) meaning that they can be both a device (downstream) and a host (upstream). These devices can request to become a host at anytime which may or may not contradict the users desired upstream setting. The method in which these events are handled is referred to as data behavior. Just as power behavior it can be configured with a similar set of APIs

List of Available Data Behaviors for USBHub3c

Behavior

Value

Define

Hard Coded

0

usbsystemDataBehavior_HardCoded

Reserved

1

usbsystemDataBehavior_Reserved

Port Priority

2

usbsystemDataBehavior_PortPriority

Hard Coded (Default Configuration)

The Hard Coded data behavior is used to fix the Upstream port to a single port and not allow it to move except for a command through the Set Upstream API or via the Serial Communication Feature.

Port Priority

The Port Priority data behavior prioritizes making the Upstream port the lowest numbered port on the front of the USBHub3c that is capable of being an Upstream port. This means a USB-C connection that’s a sink or a USB PD connection that has described itself as USB Coms Capable and can act as a Host.

Relevant API’s

stem.hub.setDataRoleBehavior() [cpp] [python] [NET] [LabVIEW]
stem.hub.getDataRoleBehavior() [cpp] [python] [NET] [LabVIEW]

Some behaviors require additional configuration. In most cases this is a list of port numbers that define which ports should be prioritised for power allication.

stem.hub.setDataRoleBehaviorConfig() [cpp] [python] [NET] [LabVIEW]
stem.hub.getDataRoleBehaviorConfig() [cpp] [python] [NET] [LabVIEW]

High Level Control of the Port Entity

The USBSystem Entity and the Port Entity are capable of doing many of the same things its merely their perspective. The PortClass acts on individual elements where as the USBSystemClass acts on all of the ports. For instance if you wanted to enable all of the ports of the USBHub3c you would need to loop through each index and individually enable each port. With the USBSystem class you can do the exact same thing, but with a single API call with each bit representing a given port.

//USBSystem Entity method.
stem.hub.setEnabledList(0x3F); //0b0011 1111 bits 0-5 set high = ports 0-5

//Port Entity method.
for(int x = 0; x <= 5; x++) {
    stem.hub.port[x].setEnabled(true);
}
stem.hub.setEnabledList() [cpp] [python] [NET] [LabVIEW]
stem.hub.getEnabledList() [cpp] [python] [NET] [LabVIEW]

The same logic can also be applied to Data Role, Mode and State elements, but with slightly different interfaces depending on the size of the data.

stem.hub.setModeList() [cpp] [python] [NET] [LabVIEW]
stem.hub.getModeList() [cpp] [python] [NET] [LabVIEW]

Data Role and State are slightly different in that there are only get calls for these functions.

stem.hub.getDataRoleList() [cpp] [python] [NET] [LabVIEW]
stem.hub.getStateList() [cpp] [python] [NET] [LabVIEW]