Я работаю над Imx8mm evk и yocto project.
Я пробовал ир-приемное решение.
Пульт дистанционного управления использует протокол NEC IR.
1. Настройка GPIO
ИК-приемник подключен к GPIO13.
Редактировать fsl-imx8mm-evk.dts
{
ir_recv {
compatible = "gpio-ir-receiver";
gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ir>;
};
:
:
:
};
&iomuxc {
pinctrl-names = "default";
pinctrl_ir: irgrp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO13_GPIO1_IO13 0x1d6
>;
};
:
:
:
GPIO13: режим ввода и вывода
root@imx8mmevk:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
gpio-13 ( |gpio-ir-recv ) in hi IRQ
gpio-15 ( |cd ) in lo IRQ
Включить ИК-пульт дистанционного управления GPIO
menuconfig ---> Device Drivers ---> Remote Controller devices ---> <*> GPIO IR remote control
2. LIRC install
Редактировать файл local.conf
Добавить эту строку.
IMAGE_INSTALL_append = " lirc"
lircd версияи проверьте драйвер lirc
root@imx8mmevk:~# lircd -version
lircd 0.9.4d
root@imx8mmevk:~# dmesg | grep "LIRC" -i
[ 1.455517] lirc_dev: IR Remote Control driver registered, major 236
[ 1.500490] IR LIRC bridge handler initialized
[ 1.535966] rc rc0: lirc_dev: driver ir-lirc-codec (gpio-rc-recv) registered at minor = 0
3. ПРОВЕРЬТЕ дистанционное управление с помощью команды mode2
Остановите и проверьте состояние драйвера lirc
root@imx8mmevk:~# systemctl stop lircd.socket lircd.service
root@imx8mmevk:~# systemctl status lircd.socket lircd.service
● lircd.socket
Loaded: loaded (/lib/systemd/system/lircd.socket; disabled; vendor preset: e>
Active: inactive (dead) since Thu 2019-09-26 07:17:02 UTC; 2min 19s ago
Listen: /run/lirc/lircd (Stream)
Sep 26 06:59:56 imx8mmevk systemd[1]: Listening on lircd.socket.
Sep 26 07:17:02 imx8mmevk systemd[1]: Closed lircd.socket.
● lircd.service - LIRC Infrared Signal Decoder
Loaded: loaded (/lib/systemd/system/lircd.service; enabled; vendor preset: e>
Active: inactive (dead) since Thu 2019-09-26 07:17:02 UTC; 2min 19s ago
Process: 3653 ExecStopPost=/bin/rm -fR /run/lirc (code=exited, status=0/SUCCE>
Process: 3652 ExecStopPost=/bin/rm -f /dev/lircd (code=exited, status=0/SUCCE>
Process: 3617 ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid --devic>
Process: 3615 ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd (code=exited>
Process: 3603 ExecStartPre=/bin/rm -f /run/lirc/lircd (code=exited, status=0/>
Process: 3602 ExecStartPre=/bin/rm -f /dev/lircd (code=exited, status=0/SUCCE>
Process: 3601 ExecStartPre=/bin/mkdir -p /run/lirc (code=exited, status=0/SUC>
Main PID: 3622 (code=killed, signal=TERM)
Sep 26 06:59:58 imx8mmevk systemd[1]: Starting LIRC Infrared Signal Decoder...
Sep 26 06:59:58 imx8mmevk systemd[1]: Started LIRC Infrared Signal Decoder.
Sep 26 07:17:02 imx8mmevk systemd[1]: Stopping LIRC Infrared Signal Decoder...
Запустите mode2 и проверьте дистанционное управление
root@imx8mmevk:~# mode2 --driver default --device /dev/lirc0
Using driver default on device /dev/lirc0
Trying device: /dev/lirc0
Using device: /dev/lirc0
Warning: Running as root.
Нажатие кнопки на моем пульте дистанционного управления (протокол NEC)
space 13301060
pulse 399019
space 9015
pulse 4474
space 594
pulse 1661
space 574
pulse 556
space 575
pulse 556
space 575
pulse 555
space 574
pulse 557
space 574
pulse 557
space 574
pulse 557
space 573
pulse 558
space 573
pulse 558
space 574
pulse 1663
space 573
pulse 1664
space 572
pulse 1663
space 573
pulse 1664
space 572
pulse 1663
space 573
pulse 1664
space 573
pulse 1663
space 573
pulse 1665
space 572
pulse 1664
space 573
pulse 558
space 572
pulse 1664
space 573
pulse 558
space 572
pulse 558
space 572
pulse 558
space 572
pulse 558
space 573
pulse 557
space 572
pulse 559
space 572
pulse 1665
space 571
pulse 558
space 572
pulse 1664
space 573
pulse 1663
space 572
pulse 1665
space 571
pulse 1664
space 572
Но я не понимаю первый и последний журнал.
пробел 13301060, пробел572
Logic Analyzer - сигнал захвата
Начальная и конечная логика имеет высокий уровень.
Но в первом и последнем журнале mode2 есть пробел. .
Я знаю, что "пробел" - это логическое время.
Что-то не так?
Подскажите, пожалуйста, как я могу решить.
Спасибо !!
без записи
root@imx8mmevk:~# irrecord -n -d /dev/lirc0 test_remote.conf
Warning: Running as root.
Using driver default on device /dev/lirc0
irrecord - application for recording IR-codes for usage with lirc
Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)
This program will record the signals from your remote control
and create a config file for lircd.
A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION at https://sf.net/p/lirc-remotes/wiki
If there already is a remote control of the same brand available at
http://sf.net/p/lirc-remotes you might want to try using such a
remote as a template. The config files already contains all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available. Templates can be downloaded using irdb-get(1). You use a
template file by providing the path of the file as a command line
parameter.
Please take the time to finish the file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ an send it
to <lirc@bartelmus.de> so it can be made available to others.
Press RETURN to continue.
Checking for ambient light creating too much disturbances.
Please don't press any buttons, just wait a few seconds...
No significant noise (received 0 bytes)
Enter name of remote (only ascii, no spaces) :NEC1
Using NEC1.lircd.conf as output filename
Now start pressing buttons on your remote control.
It is very important that you press many different buttons randomly
and hold them down for approximately one second. Each button should
generate at least one dot but never more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have
been generated.
Press RETURN now to start recording.
................................................................................
Got gap (8996 us)}
Please keep on pressing buttons like described above.
Cannot find any gap, using an arbitrary 50 ms one. If you have a
regular remote for e. g., a TV or such this is probably a point
where you hit control-C. However, technical hardware like air
condition gear often works without any gap. If you think it's
reasonable that your remote lacks gap you can proceed.
Press RETURN to continue.
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_POWER
Now hold down button "KEY_POWER".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_MODE
Now hold down button "KEY_MODE".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_1
Now hold down button "KEY_1".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_2
Now hold down button "KEY_2".
Please enter the name for the next button (press <ENTER> to finish recording)
Checking for toggle bit mask.
Please press an arbitrary button repeatedly as fast as possible.
Make sure you keep pressing the SAME button and that you DON'T HOLD
the button down!.
If you can't see any dots appear, wait a bit between button presses.
Press RETURN to continue.
Cannot find any toggle mask.
Successfully written config file NEC1.lircd.conf
NEC1.lircd.conf
begin remote
name NEC1
bits 0
eps 0
aeps 0
one 0 0
zero 0 0
gap 50000
toggle_bit_mask 0x0
frequency 38000
begin codes
KEY_POWER 0x0
KEY_MODE 0x0
KEY_1 0x0
KEY_2 0x0
end codes
end remote