TS-7180 DIO

From Technologic Systems Manuals

The i.MX6UL CPU and FPGA GPIO are exposed using a kernel character device. This interface provides a set of files and directories for interacting with GPIO which can be used from any language that interact with special files in linux using ioctl() or similar. For our platforms, we pre-install the "libgpiod" library and binaries. Documentation on these tools can be found here. This section only covers using these userspace tools and does not provide guidance on using the libgpiod library in end applications. Please see the libgpiod documentation for this purpose.

A user with suitable permissions to read and write /dev/gpiochip* files can immediately interact with GPIO pins. For example, to read the push_sw:

gpioget 2 18 # Returns 0 when pressed, 1 when not

Multiple pins in the same chip can be read simultaneously by passing multiple pin numbers separated by spaces.

This GPIO interface also provides labels for all the I/O. To get a reference from the board of all GPIO run:

gpioinfo

The TS-7180 provides seven IO ports that can sink up to 500mA, or withstand up to 30V at the input. These are available on the P3 connector. DIO_1 through DIO_7 appear as GPIO bank 5 io 37 through 43 (when used as inputs), and as GPIO bank 5 io 22 through 28 (when used as outputs). For example, to read the state of DIO_1, enter the following command:

gpioget 5 37

To drive enable the 500mA sink, enter the following command:

gpioset 5 22=1
gpiochip0 - 32 lines:
	line   0: "BOOT_MODE_0" unused input active-high 
	line   1:      unnamed       unused   input  active-high 
	line   2:  "I2C_1_CLK"       unused   input  active-high 
	line   3:  "I2C_1_DAT"       unused   input  active-high 
	line   4:      "ADC_1"       unused   input  active-high 
	line   5:      "ADC_2"       unused   input  active-high 
	line   6:   "ETH_MDIO"       unused   input  active-high 
	line   7:    "ETH_MDC"       unused   input  active-high 
	line   8:      "ADC_3"       unused   input  active-high 
	line   9:      "ADC_4"       unused   input  active-high 
	line  10:      unnamed       unused   input  active-high 
	line  11:      unnamed       unused   input  active-high 
	line  12:      unnamed       unused   input  active-high 
	line  13:      unnamed       unused   input  active-high 
	line  14:      unnamed       unused   input  active-high 
	line  15:      unnamed       unused   input  active-high 
	line  16: "CONSOLE_TXD" unused input active-high 
	line  17: "CONSOLE_RXD" unused input active-high 
	line  18:    "SPARE_1"       unused   input  active-high 
	line  19:     "EN_485"       unused   input  active-high 
	line  20:  "UART2_TXD"       unused   input  active-high 
	line  21:  "UART2_RXD"       unused   input  active-high 
	line  22:  "CAN_2_TXD"       unused   input  active-high 
	line  23: "CAN2_RXD_3V" unused input active-high 
	line  24:  "UART3_TXD"       unused   input  active-high 
	line  25:  "UART3_RXD"       unused   input  active-high 
	line  26: "UART3_CTS#"       unused   input  active-high 
	line  27: "UART3_RTS#"       unused   input  active-high 
	line  28:  "UART4_TXD"       unused   input  active-high 
	line  29:  "UART4_RXD"       unused   input  active-high 
	line  30:  "UART5_TXD"       unused   input  active-high 
	line  31:  "UART5_RXD"       unused   input  active-high 
gpiochip1 - 32 lines:
	line   0: "ENET1_RX_DATA0" unused input active-high 
	line   1: "ENET1_RX_DATA1" unused input active-high 
	line   2: "ENET1_RX_EN" unused input active-high 
	line   3: "ENET1_TX_DATA0" unused input active-high 
	line   4: "ENET1_TX_DATA1" unused input active-high 
	line   5: "ENET1_TX_EN" unused input active-high 
	line   6: "ENET1_TX_CLK" unused input active-high 
	line   7: "ENET1_RX_ER" unused input active-high 
	line   8: "ENET2_RX_DATA0" unused input active-high 
	line   9: "ENET2_RX_DATA1" unused input active-high 
	line  10: "ENET2_RX_EN" unused input active-high 
	line  11: "ENET2_TX_DATA0" unused input active-high 
	line  12: "ENET2_TX_DATA1" unused input active-high 
	line  13: "ENET2_TX_EN" unused input active-high 
	line  14: "ENET2_TX_CLK" unused input active-high 
	line  15: "ENET2_RX_ER" unused input active-high 
	line  16:     "SD_CMD"       unused   input  active-high 
	line  17:     "SD_CLK"       unused   input  active-high 
	line  18:      "SD_D0"       unused   input  active-high 
	line  19:      "SD_D1"       unused   input  active-high 
	line  20:      "SD_D2"       unused   input  active-high 
	line  21:      "SD_D3"       unused   input  active-high 
	line  22:      unnamed       unused   input  active-high 
	line  23:      unnamed       unused   input  active-high 
	line  24:      unnamed       unused   input  active-high 
	line  25:      unnamed       unused   input  active-high 
	line  26:      unnamed       unused   input  active-high 
	line  27:      unnamed       unused   input  active-high 
	line  28:      unnamed       unused   input  active-high 
	line  29:      unnamed       unused   input  active-high 
	line  30:      unnamed       unused   input  active-high 
	line  31:      unnamed       unused   input  active-high 
gpiochip2 - 32 lines:
	line   0: "HD1_SPI_CS"    "spi_imx"  output  active-high [used]
	line   1: "JTAG_FPGA_TCK" unused input active-high 
	line   2: "JTAG_FPGA_TMS" unused input active-high 
	line   3: "JTAG_FPGA_TDI" unused input active-high 
	line   4:      "WDOG#"       unused   input  active-high 
	line   5:  "I2C_3_DAT"       unused   input  active-high 
	line   6:  "I2C_3_CLK"       unused   input  active-high 
	line   7:      unnamed       unused   input  active-high 
	line   8: "HD1_I2C_CLK" "scl" output active-high [used]
	line   9: "HD1_I2C_DAT" "sda" output active-high [used]
	line  10: "HD1_DIG_INPUT" unused input active-high 
	line  11: "NO_CHRG_JMP#" unused input active-high 
	line  12: "EN_NIM_USB#" unused input active-high 
	line  13:  "CAN_1_TXD"       unused   input  active-high 
	line  14: "CAN1_RXD_3V" unused input active-high 
	line  15:  "XBEE_CTS#"       unused   input  active-high 
	line  16: "U_BOOT_JMP#" unused input active-high 
	line  17:      unnamed       unused   input  active-high 
	line  18: "PUSH_SW_CPU#" unused input active-high 
	line  19: "NIMBEL_PWR_ON" unused input active-high 
	line  20:      unnamed       unused   input  active-high 
	line  21:  "UART7_TXD"       unused   input  active-high 
	line  22:  "UART7_RXD"       unused   input  active-high 
	line  23:        "ID4"       unused   input  active-high 
	line  24: "JTAG_FPGA_TDO" unused input active-high 
	line  25:  "UART8_TXD"       unused   input  active-high 
	line  26:  "UART8_RXD"       unused   input  active-high 
	line  27:        "ID1"       unused   input  active-high 
	line  28: "ETH_PHY_RESET#" unused input active-high 
	line  29:      unnamed       unused   input  active-high 
	line  30:      unnamed       unused   input  active-high 
	line  31:      unnamed       unused   input  active-high 
gpiochip3 - 32 lines:
	line   0:   "EMMC_CLK"       unused   input  active-high 
	line   1:   "EMMC_CMD"       unused   input  active-high 
	line   2:    "EMMC_D0"       unused   input  active-high 
	line   3:    "EMMC_D1"       unused   input  active-high 
	line   4:    "EMMC_D2"       unused   input  active-high 
	line   5:    "EMMC_D3"       unused   input  active-high 
	line   6:  "SPI_4_CLK"       unused   input  active-high 
	line   7: "SPI_4_MOSI"       unused   input  active-high 
	line   8: "SPI_4_MISO"       unused   input  active-high 
	line   9:  "SPI_4_CS#"    "spi_imx"  output  active-high [used]
	line  10:  "MAG_N_IRQ"       unused   input  active-high 
	line  11: "FPGA_RESET#" unused input active-high 
	line  12: "SPI_3_FPGA_CS#" "spi_imx" output active-high [used]
	line  13:  "SPI_3_CLK"       unused   input  active-high 
	line  14: "SPI_3_MOSI"       unused   input  active-high 
	line  15: "SPI_3_MISO"       unused   input  active-high 
	line  16:      "PWM_5"       unused   input  active-high 
	line  17:  "UART6_TXD"       unused   input  active-high 
	line  18:  "UART6_RXD"       unused   input  active-high 
	line  19:        "ID5"       unused   input  active-high 
	line  20:   "GYRO_INT"       unused   input  active-high 
	line  21: "6UL_FORCE_5V_ON" unused input active-high 
	line  22: "EN_EMMC_3.3V#" "?" output active-low [used]
	line  23: "EN_YEL_LED#" "?" output active-low [used]
	line  24: "EN_RED_LED#" "?" output active-low [used]
	line  25: "EN_GRN_LED#" "?" output active-low [used]
	line  26: "EN_BLU_LED"          "?"  output  active-high [used]
	line  27: "FRAM_SPI_CS#" "spi_imx" output active-high [used]
	line  28: "SD_VSEL_1.8V" unused input active-high 
	line  29:      unnamed       unused   input  active-high 
	line  30:      unnamed       unused   input  active-high 
	line  31:      unnamed       unused   input  active-high 
gpiochip4 - 32 lines:
	line   0: "POWER_FAIL"       unused   input  active-high 
	line   1:   "FPGA_IRQ"       unused   input  active-high 
	line   2:      unnamed       unused   input  active-high 
	line   3:  "GPIO_DVFS"          "?"  output  active-high [used]
	line   4:      unnamed       unused   input  active-high 
	line   5: "SILAB_C2_CLK" unused input active-high 
	line   6: "SILAB_C2_DATA" unused input active-high 
	line   7: "SILAB_C2_RESET" unused input active-high 
	line   8:    "SPARE_4"       unused   input  active-high 
	line   9:      unnamed       unused   input  active-high 
	line  10:      unnamed       unused   input  active-high 
	line  11:      unnamed       unused   input  active-high 
	line  12:      unnamed       unused   input  active-high 
	line  13:      unnamed       unused   input  active-high 
	line  14:      unnamed       unused   input  active-high 
	line  15:      unnamed       unused   input  active-high 
	line  16:      unnamed       unused   input  active-high 
	line  17:      unnamed       unused   input  active-high 
	line  18:      unnamed       unused   input  active-high 
	line  19:      unnamed       unused   input  active-high 
	line  20:      unnamed       unused   input  active-high 
	line  21:      unnamed       unused   input  active-high 
	line  22:      unnamed       unused   input  active-high 
	line  23:      unnamed       unused   input  active-high 
	line  24:      unnamed       unused   input  active-high 
	line  25:      unnamed       unused   input  active-high 
	line  26:      unnamed       unused   input  active-high 
	line  27:      unnamed       unused   input  active-high 
	line  28:      unnamed       unused   input  active-high 
	line  29:      unnamed       unused   input  active-high 
	line  30:      unnamed       unused   input  active-high 
	line  31:      unnamed       unused   input  active-high 
gpiochip5 - 64 lines:
	line   0: "WIFI_RESET#" unused output active-high 
	line   1: "EN_WIFI_PWR" unused output active-high 
	line   2:      unnamed       unused   input  active-high 
	line   3:      unnamed       unused   input  active-high 
	line   4:      unnamed       unused   input  active-high 
	line   5:   "FRAM_WP#"       unused   input  active-high 
	line   6:    "EN_CL_1"       unused   input  active-high 
	line   7:    "EN_CL_2"       unused   input  active-high 
	line   8:    "EN_CL_3"       unused   input  active-high 
	line   9:    "EN_CL_4"       unused   input  active-high 
	line  10: "EN_ADC1_10V" unused input active-high 
	line  11: "EN_ADC2_10V" unused input active-high 
	line  12: "EN_ADC3_10V" unused input active-high 
	line  13: "EN_ADC4_10V" unused input active-high 
	line  14: "EN_SD_POWER" "?" output active-high [used]
	line  15: "EN_USB_HOST_5V" unused input active-high 
	line  16: "EN_OFF_BD_5V" unused input active-high 
	line  17: "EN_AUX_PWR"       unused   input  active-high 
	line  18: "EN_NIMBEL_3.3V" unused input active-high 
	line  19: "EN_GPS_PWR#" unused input active-high 
	line  20: "EN_CAN_XVR#" "en-can" output active-high [used]
	line  21: "EN_232_XVR"       unused   input  active-high 
	line  22: "EN_LS_OUT_1" unused input active-high 
	line  23: "EN_LS_OUT_2" unused input active-high 
	line  24: "EN_LS_OUT_3" unused input active-high 
	line  25: "EN_LS_OUT_4" unused input active-high 
	line  26: "EN_LS_OUT_5" unused input active-high 
	line  27: "EN_LS_OUT_6" unused input active-high 
	line  28: "EN_LS_OUT_7" unused input active-high 
	line  29:      unnamed       unused   input  active-high 
	line  30:      unnamed       unused   input  active-high 
	line  31:      unnamed       unused   input  active-high 
	line  32:   "DIG_IN_1"       unused   input  active-high 
	line  33:   "DIG_IN_2"       unused   input  active-high 
	line  34:   "DIG_IN_3"       unused   input  active-high 
	line  35:   "DIG_IN_4"       unused   input  active-high 
	line  36: "SD_BOOT_JMP#" unused input active-high 
	line  37:   "DIO_1_IN"       unused   input  active-high 
	line  38:   "DIO_2_IN"       unused   input  active-high 
	line  39:   "DIO_3_IN"       unused   input  active-high 
	line  40:   "DIO_4_IN"       unused   input  active-high 
	line  41:   "DIO_5_IN"       unused   input  active-high 
	line  42:   "DIO_6_IN"       unused   input  active-high 
	line  43:   "DIO_7_IN"       unused   input  active-high 
	line  44:      unnamed       unused   input  active-high 
	line  45:      unnamed       unused   input  active-high 
	line  46:      unnamed       unused   input  active-high 
	line  47:         "N7"       unused   input  active-high 
	line  48:         "P7"       unused   input  active-high 
	line  49:      unnamed       unused   input  active-high 
	line  50:      unnamed       unused   input  active-high 
	line  51:      unnamed       unused   input  active-high 
	line  52:      unnamed       unused   input  active-high 
	line  53:      unnamed       unused   input  active-high 
	line  54:      unnamed       unused   input  active-high 
	line  55:      unnamed       unused   input  active-high 
	line  56:      unnamed       unused   input  active-high 
	line  57:      unnamed       unused   input  active-high 
	line  58:      unnamed       unused   input  active-high 
	line  59:      unnamed       unused   input  active-high 
	line  60:      unnamed       unused   input  active-high 
	line  61:      unnamed       unused   input  active-high 
	line  62:      unnamed       unused   input  active-high 
	line  63:      unnamed       unused   input  active-high