General Purpose Input Output

General Purpose Input Output

GPIO, Kernel Driver Tests

Let's find if GPIOs are found under Sysfs

user@Minnowboard:~$ ls /sys/kernel/gpio
ls: cannot access /sys/kernel/gpio: No such file or directory

GPIO, Kernel Drivers Enablement

One way to enable GPIOs is to follow ELinux MinnowMax Linux Kernelarrow-up-right

Compile your kernel, once compiled we enable all needed drivers via menuconfig:

user@Minnowboard:~$ cd linux
user@Minnowboard:~$ make menuconfig

Processor type and features  --->

  [*] Intel Low Power Subsystem Support
      Symbol: X86_INTEL_LPSS [=y]
      Prompt: Intel Low Power Subsystem Support

Device Drivers  --->
  Pin controllers  --->

[*] Intel Baytrail GPIO pin control
Symbol: PINCTRL_BAYTRAIL [=y]
Prompt: Intel Baytrail GPIO pin control

Device Drivers  --->
  -*- GPIO Support  --->
  Symbol: GPIOLIB [=y]
  Prompt: GPIO Support

[*]   Debug GPIO calls
Symbol: DEBUG_GPIO [=y]
Prompt: Debug GPIO calls

[*]   /sys/class/gpio/... (sysfs interface)
Symbol: GPIO_SYSFS [=y]
Prompt: /sys/class/gpio/... (sysfs interface)

Once configured, we save the changes, compile and reboot

GPIO, Kernel Modules Tests

Ready! We test that our GPIOs are enabled in dmesg, sysfs y debugfs

To know the GPIO values let's look at the Minnowboard Elinux Wikipage

Minnowboard Elinux Wikipagearrow-up-right

or we use the following script

GPIO, Userspace Tests

A very simple test is to enable a GPIO as output and use a multimeter to check the voltage, Minnowboard MAX Pin 1 (Ground | Gnd) and Pin 21 (GPIO / Wakeup | GPIO_S5_0) are connected to the negative y positive terminales of our multimeter.

The next commands will give us the configuration and output of 0 and 3.3 Volts respectively:

GPIO, Online Resources

End of File

Last updated