lirc-rpi on the RPi2


39 posts   Page 1 of 2   1, 2
by theceej » Sat Feb 07, 2015 5:59 pm
I've just got my new Raspberry Pi 2 up and running and don't seem to be able to get Lirc running with the lirc-rpi module.

Hardware wise, I'm wired in to BCM GPIO16 using the same circuit that I used on my old B. I can drive the LED fine using wiringPi, so no problems there.

Software wise, I've tried loading the module in the traditional way with device_tree turned off in /boot/config.txt and the following in /etc/modules:
Code: Select all
lirc_dev
lirc_rpi gpio_out_pin=16

That didn't work. I've also tried keeping device_tree on and using dtoverlay=lirc-rpi,gpio_out_pin=16 in my /boot/config.txt, also with no success. When I try the latter, nothing related to lirc seems to show up in the kernel debug gpio section:
Code: Select all
# mount -t debugfs debugfs /sys/kernel/debug
# cat /sys/kernel/debug/gpio
GPIOs 0-53, platform/3f200000.gpio, pinctrl-bcm2835:
 gpio-47  (led0                ) out lo   

Has anyone managed to get lirc-rpi working on the RPi2?
Posts: 7
Joined: Sat Feb 07, 2015 5:13 pm
by vk4tux » Sat Feb 07, 2015 9:57 pm
Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?
Posts: 14
Joined: Tue Feb 12, 2013 2:09 am
by DirkS » Sat Feb 07, 2015 10:00 pm
vk4tux wrote:Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?

How is this related to the original topic?
FYI the latest version of wiringpi is compatible with the Pi2B
Posts: 6956
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by texy » Sat Feb 07, 2015 10:01 pm
vk4tux wrote:Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?


This is the wrong place to ask, please search the forum, or raise a different post.
thanks,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4961
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by vk4tux » Sat Feb 07, 2015 10:24 pm
DirkS wrote:
vk4tux wrote:Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?

How is this related to the original topic?
FYI the latest version of wiringpi is compatible with the Pi2B


because the OP has stated "I can drive the LED fine using wiringPi, so no problems there."
I am asking a question regarding that comment
Posts: 14
Joined: Tue Feb 12, 2013 2:09 am
by DirkS » Sat Feb 07, 2015 10:24 pm
theceej wrote:I've just got my new Raspberry Pi 2 up and running and don't seem to be able to get Lirc running with the lirc-rpi module.

Hardware wise, I'm wired in to BCM GPIO16 using the same circuit that I used on my old B. I can drive the LED fine using wiringPi, so no problems there.

Software wise, I've tried loading the module in the traditional way with device_tree turned off in /boot/config.txt and the following in /etc/modules:

Any specific reason you disabled device tree?
From viewtopic.php?f=28&t=97314:
* My lirc-rpi module doesn't load anymore. What do I do?
"dtoverlay=lirc-rpi".
Posts: 6956
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK
by vk4tux » Sat Feb 07, 2015 10:25 pm
texy wrote:
vk4tux wrote:Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?


This is the wrong place to ask, please search the forum, or raise a different post.
thanks,
Texy


NO
Posts: 14
Joined: Tue Feb 12, 2013 2:09 am
by theceej » Sat Feb 07, 2015 10:33 pm
DirkS wrote:
theceej wrote:I've just got my new Raspberry Pi 2 up and running and don't seem to be able to get Lirc running with the lirc-rpi module.

Hardware wise, I'm wired in to BCM GPIO16 using the same circuit that I used on my old B. I can drive the LED fine using wiringPi, so no problems there.

Software wise, I've tried loading the module in the traditional way with device_tree turned off in /boot/config.txt and the following in /etc/modules:

Any specific reason you disabled device tree?
From viewtopic.php?f=28&t=97314:
* My lirc-rpi module doesn't load anymore. What do I do?
"dtoverlay=lirc-rpi".

I tried disabling it to minimise the number of variables and rule it out as an issue. I also tried (with device tree enabled again) the dtoverlay=lirc-rpi,gpio_out_pin=16 line in my /boot/config.txt, but that doesn't work either...
Posts: 7
Joined: Sat Feb 07, 2015 5:13 pm
by theceej » Sat Feb 07, 2015 10:34 pm
vk4tux wrote:
DirkS wrote:
vk4tux wrote:Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?

How is this related to the original topic?
FYI the latest version of wiringpi is compatible with the Pi2B


because the OP has stated "I can drive the LED fine using wiringPi, so no problems there."
I am asking a question regarding that comment

I used the latest wiringPi that is RPi2 compatible and it worked as expected.
Posts: 7
Joined: Sat Feb 07, 2015 5:13 pm
by elmicha » Sun Feb 08, 2015 10:09 am
I have the same problem, apparently. The receiver works, but transmitting doesn't work. I wired a blue LED in parallel to the IR LEDs, and I can see it when I use irsend. I can also see the IR LEDs are working when I look at them with a phone camera.

But the devices that should be remote controlled by the IR LEDs don't react. Maybe the timing is off somehow? It worked on my RPi1.
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by Paul Webster » Sun Feb 08, 2015 3:24 pm
Something has gone wrong with mine today (and I have done apt-get update & upgrade today)

I might have had a file system corruption - but the symptom that I see right now is that loading of the driver fails
sudo modprobe lirc_dev
libkmod: ERROR ../libkmod/libkmod-module.c:174 kmod_module_parse_depline: ctx=0xb83cd008 path=/lib/modules/3.18.5+/kernel/drivers/media/rc/rc-core.ko error=No such file or directory
libkmod: ERROR ../libkmod/libkmod-module.c:174 kmod_module_parse_depline: ctx=0xb83cd008 path=/lib/modules/3.18.5+/kernel/drivers/media/rc/rc-core.ko error=No such file or directory
ERROR: could not insert 'lirc_dev': Unknown symbol in module, or unknown parameter (see dmesg)

Checking /lib/modules/3.18.5+/kernel/drivers/media shows it as empty but ...
on a different RPi that I have not updated recently where the most recent in /lib/modules is 3.12.28+ I see:
ls /lib/modules/3.12.28+/kernel/drivers/media/rc
ati_remote.ko imon.ko ir-mce_kbd-decoder.ko ir-rc5-sz-decoder.ko ir-sony-decoder.ko mceusb.ko redrat3.ko
gpio-ir-recv.ko ir-jvc-decoder.ko ir-nec-decoder.ko ir-rc6-decoder.ko keymaps rc-core.ko streamzap.ko
iguanair.ko ir-lirc-codec.ko ir-rc5-decoder.ko ir-sanyo-decoder.ko lirc_dev.ko rc-loopback.ko ttusbir.ko

The "rc" stuff is "remote control" - so I assume should be there.

Can someone else with an otherwise working 3.18.5 kernel see if the directory is empty for them?

(I have Device Tree disabled via config.txt)
User avatar
Posts: 665
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK
by elmicha » Sun Feb 08, 2015 3:34 pm
No, the directory is not empty:
Code: Select all
pi@rpi ~ $ ll /lib/modules/3.18.5+/kernel/drivers/media/rc/
insgesamt 336
drwxrwxr-x  3 root root  4096 Feb  5 19:40 .
drwxrwxr-x 13 root root  4096 Feb  5 19:40 ..
-rw-rw-r--  1 root root 19398 Feb  5 19:40 ati_remote.ko
-rw-rw-r--  1 root root  9718 Feb  5 19:40 gpio-ir-recv.ko
-rw-rw-r--  1 root root 14526 Feb  5 19:40 iguanair.ko
-rw-rw-r--  1 root root 40180 Feb  5 19:40 imon.ko
-rw-rw-r--  1 root root  6472 Feb  5 19:40 ir-jvc-decoder.ko
-rw-rw-r--  1 root root 12364 Feb  5 19:40 ir-lirc-codec.ko
-rw-rw-r--  1 root root 10121 Feb  5 19:40 ir-mce_kbd-decoder.ko
-rw-rw-r--  1 root root  7028 Feb  5 19:40 ir-nec-decoder.ko
-rw-rw-r--  1 root root  6379 Feb  5 19:40 ir-rc5-decoder.ko
-rw-rw-r--  1 root root  7087 Feb  5 19:40 ir-rc6-decoder.ko
-rw-rw-r--  1 root root  6913 Feb  5 19:40 ir-sanyo-decoder.ko
-rw-rw-r--  1 root root  6378 Feb  5 19:40 ir-sharp-decoder.ko
-rw-rw-r--  1 root root  6372 Feb  5 19:40 ir-sony-decoder.ko
-rw-rw-r--  1 root root  7237 Feb  5 19:40 ir-xmp-decoder.ko
drwxrwxr-x  2 root root  4096 Feb  5 19:40 keymaps
-rw-rw-r--  1 root root 22648 Feb  5 19:40 lirc_dev.ko
-rw-rw-r--  1 root root 23262 Feb  5 19:40 mceusb.ko
-rw-rw-r--  1 root root 38892 Feb  5 19:40 rc-core.ko
-rw-rw-r--  1 root root  8978 Feb  5 19:40 rc-loopback.ko
-rw-rw-r--  1 root root 18183 Feb  5 19:40 redrat3.ko
-rw-rw-r--  1 root root 11384 Feb  5 19:40 streamzap.ko
-rw-rw-r--  1 root root 11519 Feb  5 19:40 ttusbir.ko
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by DougieLawson » Sun Feb 08, 2015 3:37 pm
Try
sudo rpi-update
and move on to 3.18.6-v7+

I know that doesn't answer your problem but I don't have a 3.18.5 system left running.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.
User avatar
Posts: 28160
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by Paul Webster » Sun Feb 08, 2015 4:01 pm
DougieLawson wrote:Try
sudo rpi-update
and move on to 3.18.6-v7+


That worked - good idea.
Made note to start from scratch with this SD card after experimentation is over since I suspect I broke things while experimenting the GPIO base address stuff since I did get a system hang and a lot of errors via fsck on reboot earlier today.
User avatar
Posts: 665
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK
by theceej » Sun Feb 08, 2015 5:39 pm
Unfortunately an rpi-update did not fix my problems. Im now running on the latest kernel (3.18.6-v7+) with device tree enabled (tried it disabled too) and still can't control things with lirc. I've turned debug on lirc_rpi with device tree, the following is the lirc related output from dmesg from boot and after trying an irsend command:
Code: Select all
[    4.103431] lirc_dev: IR Remote Control driver registered, major 247
[    4.136290] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
[    4.194482] lirc_rpi: to_irq 466
[    5.148967] lirc_rpi: auto-detected active high receiver on GPIO pin 18
[    5.158079] lirc_rpi lirc_rpi: lirc_dev: driver lirc_rpi registered at minor = 0
[    5.169067] lirc_rpi: driver registered!
[    6.411018] input: lircd as /devices/virtual/input/input0
[    7.437135] lirc_rpi: Interrupt 466 obtained
[    7.437185] lirc_rpi: in init_timing_params, freq=38000 pulse=13157, space=13158
[   39.103396] lirc_rpi: SET_SEND_CARRIER
[   39.103436] lirc_rpi: in init_timing_params, freq=38000 pulse=13157, space=13158
[   39.103450] lirc_rpi: SET_SEND_DUTY_CYCLE
[   39.103465] lirc_rpi: in init_timing_params, freq=38000 pulse=13157, space=13158
I can still turn the LED on/off fine using wiringPi (to ensure wiringPi wasn't causing issues I've rebooted between using it and lirc several times too) using the following command:
Code: Select all
gpio -g write 16 1
My /boot/config.txt currently looks like this:
Code: Select all
gpu_mem=16
dtoverlay=lirc-rpi,gpio_out_pin=16,debug=on
Any ideas?
Posts: 7
Joined: Sat Feb 07, 2015 5:13 pm
by elmicha » Sun Feb 08, 2015 10:27 pm
I installed current Noobs/Raspbian on an SD card for my RPi1, and it works (with dtoverlay=lirc-rpi, and with my lircd.conf and hardware.conf). So the new kernel 3.18 or the device tree are not the culprit.

I'll get a new MicroSD card tomorrow and install a plain Raspbian on the RPi2. My current card was upgraded from the RPi1 install, maybe there is something on it that creates this problem.
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by elmicha » Mon Feb 09, 2015 9:05 pm
I tried it with the new MicroSD card and a new Noobs/Raspbian install, and it didn't work.

I also made sure that the LED gets about 20 mA when it's on (exported gpio17 and echoed "out" into direction and "1" into value), because there's a ULN2803A between the RPi's GPIO port and the LEDs.

So now I'm out of ideas for the moment.
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by theceej » Tue Feb 10, 2015 7:10 am
elmicha wrote:I tried it with the new MicroSD card and a new Noobs/Raspbian install, and it didn't work.

I also made sure that the LED gets about 20 mA when it's on (exported gpio17 and echoed "out" into direction and "1" into value), because there's a ULN2803A between the RPi's GPIO port and the LEDs.

So now I'm out of ideas for the moment.

Sounds like we both have the same issue. Has anyone got lirc-rpi working on the new Pi?
Posts: 7
Joined: Sat Feb 07, 2015 5:13 pm
by with ice cream » Thu Feb 12, 2015 1:22 pm
For me IR out is also failing. I tried it with the assumed default out pin and with specifically assigning another one.

Edit:
Code: Select all
$ uname -a
Linux berry 3.18.6-v7+ #753 SMP PREEMPT Sun Feb 8 14:53:56 GMT 2015 armv7l GNU/Linux
User avatar
Posts: 143
Joined: Mon Jul 30, 2012 7:25 am
by PhilE » Thu Feb 12, 2015 5:35 pm
First up, it's confession time. Although I have an IR receiver, I don't have an IR transmitter. However, I do have a regular red LED on the output pin.

My config.txt looks like this:
Code: Select all
dtoverlay=lirc-rpi,gpio_out_pin=16,gpio_in_pin=17,debug=on


With a suitably configured /etc/lirc/lircd.conf and /etc/lirc/hardware.conf, irw shows me data being received:
Code: Select all
0000000077e1d0bb 00 KEY_UP Apple
0000000077e1b0bb 00 KEY_DOWN Apple
0000000077e110bb 00 KEY_LEFT Apple
0000000077e1e0bb 00 KEY_RIGHT Apple
0000000077e1e0bb 01 KEY_RIGHT Apple
0000000077e1babb 00 KEY_OK Apple

, and running irsend:
Code: Select all
irsend SEND_ONCE Apple KEY_UP

causes the LED to flash.

As it happens, I'm running a 3.19.0-v7+ kernel I built myself from the standard raspberrypi/linux with one pending commit (fixing the PWR LED for 3.19), but nothing significant has changed.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1156
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge
by with ice cream » Thu Feb 12, 2015 6:51 pm
Thank you PhilE for your observations. I tried this in the past and just tried again without a test LED turning on.

/boot/options.txt:
Code: Select all
dtoverlay=lirc-rpi,gpio_out_pin=25,gpio_in_pin=18


Receiver on GPIO 1 (BCM 18) is working. "GPIO write 6 on" turns the LED on BCM pin 18 on. irsend does nothing.
User avatar
Posts: 143
Joined: Mon Jul 30, 2012 7:25 am
by elmicha » Thu Feb 12, 2015 8:57 pm
Thanks for testing, PhilE, but it seems to work here, too, if I use a blue LED and look at it. But the receiving devices don't see the IR LED. And "mode2" on another computer also doesn't see anything of "irsend send_start Eizo KEY_POWER" ("mode2" does show the pulses/spaces of the original remote).

I can see the IR LED through a phone camera if I use "gpio -g write 17 1", and I can see the IR LED very dim in the phone camera when I use "irsend send_start Eizo KEY_POWER".

So somehow the timing seems to be off. On the other hand, receiving works without problems. And everything works with kernel 3.18.x and device tree on the RPi1.
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by with ice cream » Fri Feb 13, 2015 8:33 am
OK. I can now confirm elmicha's observations. I hooked up a voltmeter and noticed very weak activity. A less demanding LED also showed a weak flicker. It might be the sluggishness of my cheap voltmeter but the flicker seems to be in the microvolt area. If I turn the pin on via command line I can see the expected 3.3V.
User avatar
Posts: 143
Joined: Mon Jul 30, 2012 7:25 am
by elmicha » Wed Feb 18, 2015 8:23 pm
I got a little logic analyzer (Saleae) and looked at the output of an "irsend send_once ...", with the analyzer's input directly at the GPIO port and no LED.

See these screenshots. The first image shows the output of the RPi1. It looks like it contains some information; the big "blocks" also contain smaller wave forms (I forgot to zoom in here).

The other three images show the situation on the RPi2: there are a couple of spikes with the width of 10µs, and with 14.73ms space in between. That really doesn't look like a meaningful IR signal.

Alas I don't know how I could even start to fix that.
Posts: 24
Joined: Tue Jul 03, 2012 4:43 pm
by joan » Wed Feb 18, 2015 8:32 pm
For those of you who don't have logic analysers you could use my piscope to view the input and output IR signals. IR pulses are quite slow.
User avatar
Posts: 12689
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK