Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6-L/Peripherals/GPIOs

2,315 bytes added, 08:09, 4 October 2022
no edit summary
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK release
|-
! | style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededededf8fb; padding:5px; color:#000000" |{{oldid|17005|17005}}! | style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededededf8fb; padding:5px; color:#000000" |03/03/2022! | style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededededf8fb; padding:5px; color:#000000" |DESK 3.0.0 release|-! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|170xx|170xx}}! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |04/10/2022! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |Adding libgpiod example
|-
|}
</pre>
===== Additional information =====
Information about GPIOs usage under sysfs directory ''https://www.kernel.org/doc/Documentation/gpio/sysfs.txt''
 
==== Usage with [https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/README libgpiod] ====
{{WarningMessage|text=''sysfs'' GPIO ABI has been deprecated. See more inofrmation [https://www.kernel.org/doc/Documentation/gpio/sysfs.rst here] about it. A character device access has to be used, more information [https://embeddedbits.org/new-linux-kernel-gpio-user-space-interface/ here]}}
Information about GPIOs library '''libgpiod''' - C library and tools - can be found on [https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ git.kernel.org]
 
===== libgpiod usage =====
It is possible yo cross-compile <code>libgpiod</code> in the target (if the related Yocto package is not available for installation). Once the ''autoconf-archive'' package has been installed
<pre>
dnf install autoconf-archive
</pre>
 
it is possible to clone the <code>libgpiod</code> git repository and compile the related sources:
 
<pre>
git clone https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
cd libgpiod
./autogen.sh --enable-tools=yes --prefix=/usr/local
make
make install
 
Once installed, the <code>gpio</code> utilities are availabel in the target:
 
<pre class="workstation-terminal">
root@desk-mx6:~# gpio
gpiodetect gpiofind gpioget gpioinfo gpiomon gpioset
root@desk-mx6:~# gpio
</pre>
 
===== gpio interrupt example =====
If a push button, with proper pull-up, is connected to a GPIO line available - for example using the J33.34 pin available on [[AXEL_Lite_SOM/AXEL_Lite_Evaluation_Kit/Interfaces_and_Connectors/WIDE | WIDE]] connector - the related GPIO can be used as an interrupt:
 
* J33.40 is connected to J10.40 SOM pin (is J10 connector on SBC AXEL Lite EVK)
** ALT-5 alternate function for this pin is GPIO1_IO06
* the corresponding pin number is 0 6
* <code>gpiomon</code> utility can be used for monitor the pin status and triggering, for exmaple, the 'falling-edge'' event
 
<pre class="workstation-terminal">
root@desk-mx6:~# gpiomon --falling-edge 0 6
event: FALLING EDGE offset: 6 timestamp: [ 696.463539802]
event: FALLING EDGE offset: 6 timestamp: [ 696.643661944]
^Croot@desk-mx6:~#
</pre>
<section end="Body" />
8,226
edits