External Load Testing

The External Load software feature allows for load testing of devices connected to ports 0-5 by way of an external connector on the back of the hub. This connector allows you to wire the USBHub3c to programmable or resistive loads so that you can test if your device is sourcing power properly.

../../../_images/usbhub3c-pd-test-sinks.jpg

This software feature can be exploited through the USBHub3c Rail Entity.

Although the external load feature will work in any mode it is only recommended to be used when the USBHub3c is sinking.

Example:

static const int TEST_PORT = 1;

aUSBHub3c stem;
stem.discoverAndConnect(USB);

// Check if we are sourcing power
uint8_t connectionState = 0;
stem.pd[TEST_PORT].getConnectionState(&connectionState);

// Ensure we are sinking
if (connectionState == powerdeliveryPowerRoleSink) {
    stem.rail[TEST_PORT].setEnable(true);

    // Do Stuff
    int32_t voltage = 0;
    int32_t current = 0;
    stem.hub.port[TEST_PORT].getVbusVoltage(&voltage);
    stem.hub.port[TEST_PORT].getVbusCurrent(&current);
    // Do Stuff

    stem.rail[TEST_PORT].setEnable(false);
}

stem.disconnect();

Relevant API’s

stem.rail[x].setEnable()[cpp][python][NET][LabVIEW]
stem.rail[x].getEnable()[cpp][python][NET][LabVIEW]