40-Pin I/O Headers Utility on I-Pi SMARC RB5

This document provides detailed instructions for utilizing the GPIO pins on the I-Pi SMARC RB5 module based on Linux.

Prerequisites

  • Power up the target device with HDMI ,Serial terminal or ADB shell.

Utilizing the GPIO Pins with Linux

  • Open Terminal. For non-root user, enter su command for root privilege.

  • To export the GPIO pin.

cd /sys/class/gpio
echo N > export (N should replace with gpio base number)
cd gpioN

Note: The GPIO base number may differ for different modules.

  • To read GPIO Pin Attributes
cat direction
cat edge
cat value

GPI

  • To set GPIO direction as input
echo in > direction
  • To read the value of a pin
cat value

GPO

  • To write the direction of a pin to output
echo out > direction
  • To write the value of a pin to high
echo 1 > value
  • To write the value of a pin to low
echo 0 > value

GPIO Pin Configurations

On CN1001 expansion connector E_GPIO and S_GPIO is available. These GPIO pins are mapped by to following numbers

S_GPIO:

S_GPIO_Name  CN1001_Pin_Number 	Sysfs_Index

S_GPIO06 pin07 398
S_GPIO07 pin12 451
S_GPIO08 pin11 485
S_GPIO09 pin13 486
S_GPIO010 pin15 488
S_GPIO011 pin16 490
S_GPIO012 pin18 492
S_GPIO013 pin22 494

E_GPIO

E_GPIO_Name  CN1001_Pin_Number 	Sysfs_Index

E_GPIO1_0 pin29 275
E_GPIO1_1 pin31 276
E_GPIO1_2 pin32 277
E_GPIO1_3 pin33 278
E_GPIO1_4 pin35 279
E_GPIO1_5 pin36 280
E_GPIO1_6 pin37 281
E_GPIO1_7 pin38 282
E_GPIO1_8 pin40 283