Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6-L/Peripherals/GPIOs

2,157 bytes added, 8 January
no edit summary
! colspan="4" style="width:100%; text-align:left" ; border-bottom:solid 2px #ededed" |History
|-
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Version
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Issue Date
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Notes
|-
| 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" |{{oldid|14083|12021/07/16}}| 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-MX6-L release|-| 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" |{{oldid|17005|2022/03/03}}| 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" |DESK-MX6-L 3.0.0release|-| 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" |{{oldid|17064|2022/10/04}}| 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" |Oct 2020Add libgpiod example|- ! 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" | 2023/04/11! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000" |First DESK -MX6-L 4.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:#edf8fb; padding:5px; color:#000000" |2.0.0
| 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" |Feb 2022
| 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" |DESK 3.0.0 release
|}
<section end="History" />
root@desk-mx6:~# ls -la /sys/class/leds/
total 0
drwxr-xr-x 2 root root 0 Apr 28 2 2020 2022 .drwxr-xr-x 54 58 root root 0 Apr 28 2 2020 2022 ..lrwxrwxrwx 1 root root 0 Apr 28 2 2020 2022 mmc0:: -> ../../devices/soc0platform/soc/2100000.aips-bus/2190000.usdhcmmc/leds/mmc0::lrwxrwxrwx 1 root root 0 Apr 28 2 2020 2022 mmc1:: -> ../../devices/soc0platform/soc/2100000.aips-bus/2194000.usdhcmmc/leds/mmc1::lrwxrwxrwx 1 root root 0 Apr 28 2 2020 2022 rs232_485_422 -> ../../devices/soc0platform/leds/leds/rs232_485_422lrwxrwxrwx 1 root root 0 Apr 28 2 2020 2022 rs232_on -> ../../devices/soc0platform/leds/leds/rs232_onroot@desk-mx6:~#
</pre>
===Userspace gpio access ===
==== Usage with [https://www.kernel.org/doc/Documentation/gpio/sysfs.txt sysfs] ====
</pre>
===== Additional information =====Information about GPIOs usage under <code>sysfs </code> 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 information [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 example =====
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
</pre>
 
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
</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 | SBC AXEL Lite WIDE]] connector - the related GPIO can be used as an interrupt:
 
* J33.40 is connected to J10.40 SOM pin
** J33 connector is the WIDE connector in the [[AXEL_Lite_SOM/AXEL_Lite_Evaluation_Kit | AXEL Lite EVK]]
** J10 connector is the SO-DIMM connector in the AXEL Lite EVK
** ALT-5 alternate function for this pin is <code>GPIO1_IO06</code>
* the corresponding pin number is 0 6
* <code>gpiomon</code> utility can be used for monitor the pin status and triggering, for example, 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