Port Entity

API Documentation: [cpp] [python] [.NET] [CCA] [REST]

The Port Entity provides control over the most basic items related to a USB Port. This includes actions ranging from a complete port enable and disable to the individual interface control. Voltage and current measurements are also included for devices which support the Port Entity.

  • Cable flip

  • Alt mode configuration

  • Error clearing

  • Connect mode

  • SBU enable/disable

Ports are referenced by their instance index port[x] as shown below.

Port Label

Index (port[x])

Mux 0-3

0-3

Control

4

Common

5

Data and Power Control (Common Port)

stem.hub.port[x].setEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable the entire port, including both data and power lines.

stem.hub.port[x].setPowerEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getPowerEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable VBUS power only (independent of data path).

stem.hub.port[x].setDataEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable USB data lines (both USB 2.0 Hi-Speed and USB 3.x SuperSpeed) without affecting VBUS.

stem.hub.port[x].setDataHSEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataHSEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable only the USB 2.0 Hi-Speed data lines.

stem.hub.port[x].setDataSSEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataSSEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable only the USB 3.x SuperSpeed lanes.

stem.hub.port[x].setCCEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCCEnabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable both CC lines simultaneously.

stem.hub.port[x].setCC1Enabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC1Enabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].setCC2Enabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC2Enabled() [cpp] [python] [NET] [LabVIEW]

Enable or disable individual CC1 / CC2 pins.

Electrical Measurements (Common, Mux, and Control Ports)

Voltage (µV)

stem.hub.port[x].getVbusVoltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getVconnVoltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getSBU1Voltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getSBU2Voltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC1Voltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC2Voltage() [cpp] [python] [NET] [LabVIEW]

Current (µA)

stem.hub.port[x].getVbusCurrent() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getVconnCurrent() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC1Current() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCC2Current() [cpp] [python] [NET] [LabVIEW]

Note

SBU1 / SBU2 expose voltage only.

Port Mode

stem.hub.port[x].setMode() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getMode() [cpp] [python] [NET] [LabVIEW]

Port Mode provides a higher-level shortcut that bundles these controls into a single bit-mapped configuration, allowing you to enable or disable groups of lines and set routing behaviors in one operation.

Bit

Port Mode Bit Map

0

Reserved

1

Reserved

2

Keep Alive Charging Enable

3

Reserved

4

HS Data enable

5

Reserved

6

VBUS enable

7

SS Data enable

8:11

Reserved

12

CC1 enable

13

CC2 enable

14

SBU enable

15

CC Flip enable

16

Super-Speed Flip enable

17

SBU Flip enable

18

Hi-Speed Flip enable

19:31

Reserved

Accumulated Power

stem.hub.port[x].getVbusAccumulatedPower() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getVconnAccumulatedPower() [cpp] [python] [NET] [LabVIEW]

Reads total accumulated energy (mWh) sourced or sunk on VBUS and VCONN.

stem.hub.port[x].resetVbusAccumulatedPower() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].resetVconnAccumulatedPower() [cpp] [python] [NET] [LabVIEW]

Resets accumulated energy and measurement interval.