IMX8 gpio ir receiver using LIRC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8 gpio ir receiver using LIRC

3,468 Views
bbq56go
Contributor I

I am working on Imx8mm evk and yocto project. (4.14.78_1.0.0_ga)
I have been trying ir-receiver solution.
The Remote Control is using the NEC IR Protocol.

1. GPIO setting

  • Edit 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
    >;
    };
    :
    :
    :

    };

  • Enable GPIO IR remote control

    menuconfig ---> Device Drivers ---> Remote Controller devices ---> <*> GPIO IR remote control

  • GPIO1_13 status

    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

2. LIRC install

  • Edit the local.conf file

    IMAGE_INSTALL_append = " lirc"

  • lircd version and check lirc driver

    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. TEST remote using mode2 command

  • Stop and check status lirc driver

    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...

  • Run mode2 and test remote control

    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.

  • Press button on my remote control (NEC protocol)

    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

But, I don't understand first and last log.
space 13301060, space 572


Start and End logic is High. (Check signal using logic analyzer)

pastedImage_17.png
But, mode2 first and last log is space..
I know 'space' is logic low time.
Is there anything wrong?
Please suggest me how can I supposed to solve.

Thank you.

0 Kudos
2 Replies

2,864 Views
gpsri
Contributor I

Hi Igor,

I too facing the same problem. If you already fixed the issue could you please share your experience?  

Thank you very much 

0 Kudos

2,947 Views
igorpadykov
NXP Employee
NXP Employee

Hi JaeHo

one can check lirc manual LIRC - Linux Infrared Remote Control 

and post issue on lirc wiki : LIRC - ArchWiki 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos