Mail: bookworepeng@Hotmail.com
QQ: 196568501
Author: drivemonkey
Undertake various embedded outsourcing projects (phone: 13410905075)
Two tools are available for Linux to debug gpio.
Dubugfs
The other is the gpio driver framework of Linux.
First, debugfs's usage for gpio debugging
1. debugfs on Mount
Mount-T debugfs/sys/kernel/debug
2. Find the Pin Multi-path configuration option
My path is ../debug/omap_mux
You can view all the configurations of the current gpio.
Another method is to debug in the driver framework provided by the Linux kernel.
1. Find the file interface path provided by the driver to the application
/Sys/class/gpio
The usage of each file in gpio is as follows:
$ Echo 30>/sys/class/gpio/Export
-
Change the gpio pin direction to in/out
$ Echo "out">/sys/class/gpio/gpio30/Direction
Or
$ Echo "in">/sys/class/gpio/gpio30/Direction
-
Change the value
$ Echo 1>/sys/class/gpio/gpio30/value
Or
$ Echo 0>/sys/class/gpio/gpio30/value
-
Unexport the gpio pin
$ Echo 30>/sys/class/gpio/unexport