node-rpio freezes on Balena cloud

Hi all,

I have a problem with polling GPIO pins on Raspberry 2/3. The system works for 5 to 15 seconds, but then freezes completely and I need to flash the sd card again to get back running.

The code works locally without problems (on command line). I can also see GPIO polling working if I try this in the console (Balena cloud’s ssh window), but the system freezes quickly.

There’s a minimal example here (rpio test), where a button click switches a led strip between green/red, and here’s my dockerfile for the example.

I noticed that some other people have encountered the same (or similar) issue, but I wasn’t able to figure out what they finally did to get everything working.

I’ve set BALENA_HOST_CONFIG_dtoverlay=gpio-no-irq as per the instructions.

I’m pulling my hair out because of this. If anyone had a working example or any hints on how to solve this, I’d be eternally grateful.

Aleksi

Hi Aleksi.

I think I can help you out here. The issue for me was rpio - the example code there simply does not work on a balena rasperry pi.

I would recommend trying out https://github.com/fivdi/onoff.

Let me know if you get stuck with this.

Thanks for answering @alexb!

@aqmattil , please let us know if this does not solve your problem.

Kind regards
Alida

Hi Alex,

Thanks a million! Switching to onoff solved this!