Page 1 of 2

lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 5:59 pm
by theceej
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?

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 9:57 pm
by vk4tux
Is there a different wiring Pi for the Pi ver 2 rather than for the previous ?

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:00 pm
by DirkS
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

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:01 pm
by texy
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

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:24 pm
by vk4tux
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

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:24 pm
by DirkS
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 http://www.raspberrypi.org/forums/viewt ... 28&t=97314:
* My lirc-rpi module doesn't load anymore. What do I do?
"dtoverlay=lirc-rpi".

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:25 pm
by vk4tux
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

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:33 pm
by theceej
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 http://www.raspberrypi.org/forums/viewt ... 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...

Re: lirc-rpi on the RPi2

Posted: Sat Feb 07, 2015 10:34 pm
by theceej
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.

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 10:09 am
by elmicha
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.

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 3:24 pm
by Paul Webster
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)

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 3:34 pm
by elmicha
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

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 3:37 pm
by DougieLawson
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.

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 4:01 pm
by Paul Webster
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.

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 5:39 pm
by theceej
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?

Re: lirc-rpi on the RPi2

Posted: Sun Feb 08, 2015 10:27 pm
by elmicha
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.

Re: lirc-rpi on the RPi2

Posted: Mon Feb 09, 2015 9:05 pm
by elmicha
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.

Re: lirc-rpi on the RPi2

Posted: Tue Feb 10, 2015 7:10 am
by theceej
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?

Re: lirc-rpi on the RPi2

Posted: Thu Feb 12, 2015 1:22 pm
by with ice cream
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

Re: lirc-rpi on the RPi2

Posted: Thu Feb 12, 2015 5:35 pm
by PhilE
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.

Re: lirc-rpi on the RPi2

Posted: Thu Feb 12, 2015 6:51 pm
by with ice cream
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.

Re: lirc-rpi on the RPi2

Posted: Thu Feb 12, 2015 8:57 pm
by elmicha
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.

Re: lirc-rpi on the RPi2

Posted: Fri Feb 13, 2015 8:33 am
by with ice cream
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.

Re: lirc-rpi on the RPi2

Posted: Wed Feb 18, 2015 8:23 pm
by elmicha
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.

Re: lirc-rpi on the RPi2

Posted: Wed Feb 18, 2015 8:32 pm
by joan
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.