Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The i.MX 8M Mini processor contains five general-purpose input/output (GPIO) peripherals, each having 32 GPIO lines. Some of the GPIO lines are accessible as the module's GPIO lines (for the particular mapping see the relevant module-specific GPIO section).

The GPIO peripherals are in Linux exposed\* in /sys filesystem and can be controlled from command line in the following way (for other means read the Linux kernel GPIO documentation).

Reading a GPIO

Code Block
languagebash
cd /sys/class/gpio
echo <ExportNo> > export
cd gpio<ExportNo>
echo in > direction
cat value

Setting a GPIO

Code Block
languagebash
cd /sys/class/gpio
echo <ExportNo> > export
cd gpio<ExportNo>
echo out > direction
echo 1 > value
echo 0 > value

Note: The Linux export number (ExportNo) is the number under which is the GPIO mapped and accessible in Linux; see the module-specific GPIO section for the particular numbers

\* The /sys/class/gpio subsystem was dropped in the 5.15.32-2.0.0 kernel; functions of the libgpiod library have to be used for accessing of GPIOs from this version on