tl;dr - Can the Pi board itself interfere with IR signals, but only temporarily?
I'm having a vexing issue with my Pi 2. I have an IR sensor wired up to the GPIO pins (3.3V, GND, and #18). I'm running Arch and using lircd to interpret the IR signal. 95% of the time, everything works great! But the other 5% of the time is really stumping me.
During that time, the system doesn't react at all when I send IR signals. By putting lircd into debug mode, I can see that it thinks it is receiving garbage. It simply can't decode the signals. I know for a fact that the remote is not sending garbage; I have two systems right next to each other, and one of them responds just fine. So the IR signal coming from the remote is fine.
A logical explanation would be IR receiver interference, but I think this is unlikely for a few reasons. First, the aforementioned system that is sitting right next to the failing system and working. Second, restarting the unit always clears the problem (but restarting lircd does not). It seems unlikely that any interference would coincidentally clear every time I restart (unless the interference is coming from the hardware itself; more on that shortly). Finally, I've seen this behavior in all manner of environments at all times of day and night (to rule out sunlight).
This behavior is by all appearances random (though logic tells me it can't be). The one interesting thing is that I can recreate the symptoms at will by disconnecting the HDMI cable for at least 60 seconds and then reconnecting it. (60 seconds is when my monitor times out; not sure if that's important or coincidence.) If I do that, lircd interprets any signals for the next 3-5 minutes (it’s not consistent) as garbage. After 3-5 minutes, it clears up and signals come through clean again. Oh, and just to totally confuse the issue, the garbage doesn’t happen if I wait 60 seconds and then send an IR signal immediately before reconnecting the HDMI. I have to go at least 60 seconds without sending any IR signals before reconnecting the HDMI to see the garbage. Huh? This makes absolutely no sense to me.
I’ve debugged every software layer I can think to debug, leaving me thinking I have a hardware issue here. And I have recreated this behavior on a large number of Pi 2 units, so I know it’s not just a bad unit or two. But the fact that it doesn’t fail all the time is what really confuses me. If the IR sensor were bad, it would never work. If the GPIO pins were bad, it would never work. Is it possible that the Pi itself could be interfering? That would explain why it clears upon reboot, but it doesn’t explain why firing an IR signal immediately before reconnecting the HDMI prevents it.
And just to be clear, disconnecting/reconnecting the HDMI simply produces the same symptoms. I don’t actually know if it’s the same root cause as when it happens at other times. But since I can’t pinpoint a way to reliably reproduce the issue any other way, it’s the best I can do to allow me to debug.
As a developer, every fiber of my being says there is a logical explanation for this, but I’m at a total loss to find it. Every theory I have has serious holes in it. So now I’m throwing this out to the community at large for help. I'm really curious if other folks can reproduce this, and if so, if they can do so on other OSes. One thing I haven't done is test on an OS other than Arch.
Thank you in advance for any ideas or leads you may have!