TS-9370 GPIO

From embeddedTS Manuals
Note: This section is incomplete at this time.

The i.MX93 CPU and FPGA GPIOs 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 see if input power has failed:

gpioget $(gpiofind PUSH_SW_N)

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

To write to a pin, the gpioset command is used. For example, to set MIKRO_RESET#:

gpioset $(gpiofind MIKRO_RESET_N)=1

Multiple pins in the same chip can be set simultaneously by passing multiple pin=value pairs separated by spaces.

If a call with gpioset or gpioget fails with "Device or resource busy," that means that specific GPIO is claimed by another device. The command cat /sys/kernel/debug/gpio can be used to get a list of all of the system GPIO and what has claimed them.

The gpiomon tool can be used to monitor pins for changes to GPIOs that generate interrupts (i.e., CPU GPIOs).

Schematic Net Name Bank Line Direction [1] Reset Output Value [2] Location
EN_GREEN_LED# 4 0 DO 1 Green LED
EN_YEL_LED# 4 1 DO 1 Yellow LED
EN_RED_LED# 4 2 DO 1 Red LED
EN_BLUE_LED 4 3 DO 0 Blue LED
NIM_RESET# 4 4 DIO 0 CN16 pin 5
NIM_CTS# 4 5 DI N/A CN16 pin 12
NIM_PWR_ON# 4 6 DIO 0 CN16 pin 20
EN_NIM_USB# 4 7 DO 1 Onboard
EN_NIM_4V [3] 4 8 DO 0 CN16 pin 20
EN_NIM_3P3V [3] 4 9 DO 0 CN16 pin 20
NIM_TXD 4 10 DIO 0 CN16 pin 3
NIM_RXD 4 11 DIO 0 CN16 pin 2
EN_USB_HOST1_VBUS 4 12 DO 0 Onboard
EN_USB_HOST2_VBUS 4 13 DO 0 Onboard
MIKRO_TXD 4 14 DIO 0 CN17 pin 13
MIKRO_RXD 4 15 DIO 0 CN17 pin 14
MIKRO_SPI_CLK 4 16 DIO 0 CN17 pin 4
MIKRO_SPI_CS# 4 17 DIO 0 CN17 pin 3
MIKRO_SPI_MISO 0 18 DIO 0 CN17 pin 5
MIKRO_SPI_MOSI 4 19 DIO 0 CN17 pin 6
MIKRO_RESET# 4 20 DIO 0 CN17 pin 2
MIKRO_AN 4 21 DIO 0 CN17 pin 1
MIKRO_PWM 4 22 DIO 0 CN17 pin 16
MIKRO_INT 4 23 DIO 0 CN17 pin 15
NIM_STATUS 4 30 DIO 0 CN16 pin 13
EN_2ND_PORT_232 5 0 Output 0 Onboard
EN_CAN_1 5 1 Output 0 Onboard
EN_CAN_2 5 2 Output 0 Onboard
USB_HUB_RESET# 5 4 DO 0 Onboard
PUSH_SW# 5 5 DI N/A SW1
EN_ADC_3_12V 5 21 DO 0 #FPGA ADC Controller
EN_ADC_1_2_12V 5 22 DO 0 #FPGA ADC Controller
AN_SEL_0 5 23 DO 0 #FPGA ADC Controller
AN_SEL_1 5 24 DO 0 #FPGA ADC Controller
EN_CL_1_2 5 25 DO 0 #FPGA ADC Controller
EN_CL_3 5 26 DO 0 #FPGA ADC Controller
DP_RESET# 5 27 DO 0 Onboard
NO_SCAP_CHRG# 5 28 DI N/A #Jumpers (HD4)
EN_SPKR_AMP 5 29 DO 0 Onboard
BT_EN 5 30 DO 0 Onboard
WIFI_EN 5 31 DO 0 Onboard
MAGNET_IRQ 6 0 DI N/A Onboard
GYRO_IRQ 6 1 DI N/A Onboard
clear_fault 6 15 DO 0 Ciruit Breaker
EN_HS_SW 6 16 DO 0 Terminal Block pin 2
EN_LS_OUT_1 6 17 DO 0 Terminal Block pin 6
EN_LS_OUT_2 6 18 DO 0 Terminal Block pin 5
EN_LS_OUT_3 6 19 DO 0 Terminal Block pin 4
EN_LS_OUT_4 6 20 DO 0 Terminal Block pin 3
circuit_breaker_fault 6 21 DO 0 Ciruit Breaker
DIO_FAULT# 6 22 DO 0 Direct DIO Fault [4]
DIO_1_IN 6 23 DI N/A Terminal Block pin 6
DIO_2_IN 6 24 DI N/A Terminal Block pin 5
DIO_3_IN 6 25 DI N/A Terminal Block pin 4
DIO_4_IN 6 26 DI N/A Terminal Block pin 3
DC_1 6 27 DIO 0 HD10 pin 1
DC_3 6 28 DIO 0 HD10 pin 3
DC_5 6 29 DIO 0 HD10 pin 5
DC_7 6 30 DIO 0 HD10 pin 7
DC_9 6 31 DIO 0 HD10 pin 9
  1. Pins may be "DIO", supporting both input/output, "DI", supporting only input, or "DO", supporting only output.
  2. All DIO pins are tristated inputs by default.
  3. 3.0 3.1 EN_NIM_4V and EN_NIM_3P3V cannot both be 1 at the same time, or both will turn off. Only 1 bit should be set
  4. In most cases "circuit_breaker_fault" should be sampled instead. This is the live sample, not the latched fault