RSB-3730 GPIO

From ESS-WIKI
Revision as of 09:47, 10 November 2023 by Xingxing.li (talk | contribs) (Created page with " The IMX8MM bank/bit notation for GPIOs must be formed as "GPIO<GPIO_bank>_<gpio_bit>".<br/> The numeric value of GPIO is calculated as follows: <pre>gpio_bit : 0~31 E.g. GPIO...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The IMX8MM bank/bit notation for GPIOs must be formed as "GPIO<GPIO_bank>_<gpio_bit>".
The numeric value of GPIO is calculated as follows:

gpio_bit : 0~31 E.g. GPIO5_22 becomes 150

“GPIO11” and “GPIO12” can be controlled by the CPU or by the i2c extended gpio based on the high and low levels of “GPIO_SELECT”.

RSB-3730 GPIO.png

Export GPIO then you can use control GPIO from user space through sysfs.
The node numbers of the exported gpio are consistent with the export order, increasing from 1.
Export GPIO1

 # echo 150> /sys/class/gpio/export

Set GPIO direction to in/out

 # echo "out" > /sys/class/gpio/gpio1/direction

Set GPIO value 0/1 if GPIO pin define is output

 # echo 1 > /sys/class/gpio/gpio1/value

Get GPIO value

 # cat /sys/class/gpio/gpio1/value