![Kontron SMARC-sAL28 Скачать руководство пользователя страница 48](http://html1.mh-extra.com/html/kontron/smarc-sal28/smarc-sal28_user-manual_1996505048.webp)
SMARC-sAL28 User Guide. Rev. 1.0
// 48
8/
Implementation Notes
8.1.
GPIO
SMARC GPIO0-GPIO11 lines are mapped in Linux in the following way:
Table 27: GPIO
Name
Legacy interface:
“/sys/class/gpio”
Modern interface: “/dev/gpiochip”
GPIO0
gpio400
GPIO0_CAM0_PWR_N
GPIO1
gpio401
GPIO1_CAM1_PWR_N
GPIO2
gpio402
GPIO2_CAM0_RST_N
GPIO3
gpio403
GPIO3_CAM1_RST_N
GPIO4
gpio404
GPIO4_HDA_RST_N
GPIO5
gpio405
GPIO5_PWM_OUT
GPIO6
gpio406
GPIO6_TACHIN
GPIO7
gpio407
GPIO7
GPIO8
gpio392
GPIO8
GPIO9
gpio393
GPIO9
GPIO10
gpio394
GPIO10
GPIO11
gpio395
GPIO11
These GPIOs could be controlled either over sysfs (legacy approach), as documented in
https://elixir.bootlin.com/linux/v4.14/source/Documentation/gpio/sysfs.txt . For example, following shell script
blinks carrier's LED connected to GPIO5 line:
echo 405 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio405/direction
while true; do
echo 0 > /sys/class/gpio/gpio405/value
sleep 1
echo 1 > /sys/class/gpio/gpio405/value
sleep 1
done
Or via modern “/dev/gpiochip” interface, information about which and corresponding examples/tools can be found
at following links:
https://elixir.bootlin.com/linux/v4.14/source/include/uapi/linux/gpio.h
https://elixir.bootlin.com/linux/v4.14/source/tools/gpio
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/README?h=v1.4.x
GPIO5 and GPIO6 are shared with PWM_OUT and TACHIN signals, so one function (fan, gpio)
can be used at the same time.
Also the gpio lines support interrupt handling from userspace. For this purpose the attributes "edge" and "value" in
sysfs should be used. There is a simple program in C language which gratefully illustrate how this interface may be
used by developers: https://developer.ridgerun.com/wiki/index.php?title=Gpio-int-test.c
Plus a gpiomon tool from libgpiod tools, which is provided as part of the BSP, can be used to monitor the GPIO
interrupts. E.g.:
# gpiofind GPIO7
gpiochip4 7
Содержание SMARC-sAL28
Страница 1: ...USER GUIDE 1 SMARC sAL28 Doc Rev 1 0 Doc ID 1064 6120...
Страница 2: ...SMARC sAL28 Rev 1 0 www kontron com 2 This page has been intentionally left blank...
Страница 22: ...SMARC sAL28 User Guide Rev 1 0 www kontron com 22 Figure 4 Bottom View 3 Product label 3...
Страница 28: ...SMARC sAL28 User Guide Rev 1 0 www kontron com 28...