I2C

YKUSH3 I2C interface

YKUSH3 board exposes an I2C interface that can be used for controlling the switching of the board ports or as a USB-to-I2C gateway.

To use the I2C interface it must be configured into one of these two modes. Check the USB commands related with the I2C interface.

I2C as a control interface

When using the I2C as a control interface the board will operate as a I2C slave device, in the I2C bus it’s connected to, which allows for a master device in the bus to transmit commands to the YKUSH3 board.

The following timing diagram illustrates the command transmission in the I2C bus.

YKUSH3 I2C timing diagram

To transmit a command to YKUSH3 I2C interface the master I2C device sends the 7-bit YKUSH3 board address followed by a command byte.

The YKUSH3 board default address is 0b1010011 in binary.

Bellow the list of commands and the respective data byte that the I2C master device should transmit to YKUSH3 to execute it.

Data byte Command
0x03 Switch on port 1
0x04 Switch on port 2
0x05 Switch on port 3
0x07 Switch on port 1
0x08 Switch on port 2
0x09 Switch on port 3
0x0B Switch on all ports
0x0C Switch off all ports

The following is an example of a reception of an I2C message with a command.

  1. I2C master creates a start condition on the bus
  2. I2C master transmit the 7-bit YKUSH3 device address with a write bit
  3. YKUSH3 will acknowledge
  4. I2C master transmits the data byte with the command value
  5. YKUSH3 acknowledges
  6. Master creates a stop condition
  7. YKUSH3 board executes the command

USB-to-I2C gateway

Hardware connections

The I2C lines, SDA and SCL, have pull-up resistors and can be connected to a 3.3V I2C bus.

Additional resources

Check the how to configure and use YKUSH3 I2C as a USB-to-I2C gateway.