This manual page refers to software version v1.2.0.

Command list

Legend:

<> Variable
[] Optional parameter
> Command line

Downstream port commands

The structure of the downstream port commands is as follows.

ykushcmd ykush3 [-s <serial_number>] -<action> <port>

Where:

serial_number Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.
action u → Turn ON/UP the downstream
d → Turn OFF/DOWN the downstream
g → Get downstream port status
l → List boards attached
port 1, 2 or 3.

Some examples:

Turn OFF the downstream port 1 (if only one YKUSH3 board is attached).

ykushcmd ykush3 -d 1

Turn OFF the downstream port 1 of the board with serial number YKB00001.

ykushcmd ykush3 -s YKB00001 -d 1

Get status of downstream port 2

ykushcmd ykush3 -g 2

List attached YKUSH3 boards

ykushcmd ykush3 -l

5V output switched port control commands

The structure of commands:

ykushcmd ykush3 [-s <serial_number>] -<action>

Where:

serial_number Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.
action on → Turn ON.
off → Turn OFF.

Some examples:

Turn OFF the 5V Out port (if only one YKUSH3 board is attached).

ykushcmd ykush3 -off

Turn ON the 5V Out port of the board with serial number YKB00001.

ykushcmd ykush3 -s YKB00001 -on

GPIO control configuration commands

Commands to enable/disable the ability to control the downstream ports using the inputs of the board GPIO pins.

Structure of commands:

ykushcmd ykush3 [-s <serial_number>] --gpio <action>

Where:

serial_number Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.
action enable → Enable the GPIO control of the downstream ports.
disable → Disable the GPIO control of the downstream ports.

GPIO Read/Write commands

Commands to read/write the logical value of the GPIO pins.

Structure of commands:

ykushcmd ykush3 [-s <serial_number>] -<action> <gpio> <value>

Where:

serial_number Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.
action w → Write to GPIO.
r → Read from GPIO.
gpio 1 → GPIO 1.
2 → GPIO 2.
3 → GPIO 3.
value 1 → Set GPIO to High.
0 → Set GPIO to Low.

Some examples:

Set GPIO 2 to high (1).

ykushcmd ykush3 -w 2 1

Read the GPIO 2.

ykushcmd ykush3 -r 2

NOTE: For Windows operating systems add the .exe extension when calling the ykushcmd command.

Downstream ports configuration commands

Sets the default state of the downstream ports on power-on.

Structure of commands:

ykushcmd ykush3 [-s <serial_number>] -c <port> <value>

Where:

serial_number Serial number of a board. This is an optional parameter useful for when multiple boards are attached to the same host.
port 1, 2 or 3.
value 1 → ON state. 0 → OFF state.

Some examples:

Set default state of downstream port 2 at power-on to ON.

ykushcmd ykush3 -c 2 1

Set default state of downstream port 2 at power-on to OFF.

ykushcmd ykush3 -c 2 0

I2C interface commands

YKUSH3 boards have an I2C interface alowing them to be connected to a I2C bus and communicate to other devices in that bus. The board can be configured in I2C slave mode, for other I2C devices to be able to control the switching of the downstream ports, or in master mode to be able to control other I2C devices.

To configure the board to operate I2C in slave mode and be controlable by a master I2C device the user must enable the i2C control interface feature.

When the board is configure with I2C in master mode it provides a USB to I2C gateway funcionality. With this USB to I2C gateway functionality a user can communicate with a slave I2C device, connected in the same I2C bus than YKUSH3 board, from the command line of the PC using ykushcmd application.

Command usage

ykushcmd ykush3 [OPTION]...

The following options are available:

--i2c-enable-control Enables I2C as a control interface. This will configure I2C in slave mode.
--i2c-disable-control Disables I2C as a control interface.
--i2c-enable-gateway Enables USB to I2C gateway functionality. This will configure I2C in master mode.
--i2c-disable-gateway Disables USB to I2C gateway functionality.
--i2c-set-address <address> Set the board I2C address. The address should be in hexadecimal representation with a 0x prefix. Example: 0x1F for 7-bit address 0011111. This address is only used when the board is configured with I2C in slave mode.
--i2c-write <dev_address> <num_bytes> <byte1>... Writes num_bytes (byte1...) to the I2C slave device with address dev_address. dev_address is in hexadecimal representation with a 0x prefix. num_bytes is in decimal representation. byte1...byteN is in hexadecimal representation with a 0x prefix.
--i2c-read <dev_address> <num_bytes> Reads num_bytesfrom the I2C slave device with address dev_address.
--i2c-usb-serial <serial_number> Serial number of the YKUSH3 board. This is an optional parameter useful for when multiple YKUSH3 boards are attached to the same host.

Examples

Enable I2C control interface:

ykushcmd ykush3 --i2c-enable-control

Set the board I2C address to 0x1A:

ykushcmd ykush3 --i2c-set-address 0x1A

Write bytes 0x12 0xAA 0x2F to I2C device with address 0x07:

ykushcmd ykush3 --i2c-write 0x07 3 0x12 0xAA 0x2F

Reset command

Triggers a reset of the board.

Structure of command:

ykushcmd ykush3 [-s <serial_number>] --reset

Examples:

Reset the attached board.

ykushcmd ykush3 --reset

Reset the attached board with serial number YK00001.

ykushcmd ykush3 -s YK00001 --reset

Versioning commands

Get version of the firmware loaded in the board.

Command usage

ykushcmd ykush3 [OPTION]

The following options are available:

--version-bootloader Get bootloader version from board.
--version-firmware Get firmware version from board.

Examples

Get bootloader version:

ykushcmd ykush3 --version-bootloader

Get firmware version:

ykushcmd ykush3 --version-firmware

Important links