~alpine/devel

2 2

Enable GPIO for RPi 4

Thomas Schneider <t.schneider@disroot.org>
Details
Message ID
<2db66cb8-eb3d-e7cc-03ff-e3538b794c77@disroot.org>
DKIM signature
missing
Download raw message
Hello,

I want to use a RPi power button
<https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi>
and this requires GPIO <https://pimylifeup.com/raspberry-pi-gpio/>.

However, it looks like GPIO is disabled in RPi 4.
When I start a relevant Python program I get this error:
$ sudo /usr/bin/python3 /opt/fanshim-python/examples/poweroff.py
traceback (most recent call last):
  File "/opt/fanshim-python/examples/poweroff.py", line 12, in <module>
    GPIO.wait_for_edge(button_pin, GPIO.FALLING)
RuntimeError: Error waiting for edge

Can you please advise how to fix this issue?

This isssue is not reproducible with Raspbian OS (based on Debian).

THX
Thomas
Details
Message ID
<8FF912BF-7CB4-478E-88D0-CF29DF411EA0@icloud.com>
In-Reply-To
<2db66cb8-eb3d-e7cc-03ff-e3538b794c77@disroot.org> (view parent)
DKIM signature
missing
Download raw message
Can you see gpio in /sys/class/gpio ?

Or an overlay might help: https://github.com/raspberrypi/firmware/blob/4fe2e4af02058f88f991469349a335a25a2c719d/boot/overlays/README#L1166

> On 17 Apr 2022, at 15:55, Thomas Schneider <t.schneider@disroot.org> wrote:
> 
> Hello,
> 
> I want to use a RPi power button
> <https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi>
> and this requires GPIO <https://pimylifeup.com/raspberry-pi-gpio/>.
> 
> However, it looks like GPIO is disabled in RPi 4.
> When I start a relevant Python program I get this error:
> $ sudo /usr/bin/python3 /opt/fanshim-python/examples/poweroff.py
> traceback (most recent call last):
>   File "/opt/fanshim-python/examples/poweroff.py", line 12, in <module>
>     GPIO.wait_for_edge(button_pin, GPIO.FALLING)
> RuntimeError: Error waiting for edge
> 
> Can you please advise how to fix this issue?
> 
> This isssue is not reproducible with Raspbian OS (based on Debian).
> 
> THX
> Thomas
> 
Thomas Schneider <t.schneider@disroot.org>
Details
Message ID
<85099931-9bf0-f804-bdd4-1969b26df380@disroot.org>
In-Reply-To
<8FF912BF-7CB4-478E-88D0-CF29DF411EA0@icloud.com> (view parent)
DKIM signature
missing
Download raw message
Hello,

issue solved after pip install RPi.GPIO.

Thanks for your support.




Am 17.04.22 um 18:46 schrieb Duncan Bellamy:
> Can you see gpio in /sys/class/gpio ?
>
> Or an overlay might
> help: https://github.com/raspberrypi/firmware/blob/4fe2e4af02058f88f991469349a335a25a2c719d/boot/overlays/README#L1166
>
>> On 17 Apr 2022, at 15:55, Thomas Schneider <t.schneider@disroot.org>
>> wrote:
>>
>> Hello,
>>
>> I want to use a RPi power button
>> <https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi>
>> and this requires GPIO <https://pimylifeup.com/raspberry-pi-gpio/>.
>>
>> However, it looks like GPIO is disabled in RPi 4.
>> When I start a relevant Python program I get this error:
>> $ sudo /usr/bin/python3 /opt/fanshim-python/examples/poweroff.py
>> traceback (most recent call last):
>>   File "/opt/fanshim-python/examples/poweroff.py", line 12, in <module>
>>     GPIO.wait_for_edge(button_pin, GPIO.FALLING)
>> RuntimeError: Error waiting for edge
>>
>> Can you please advise how to fix this issue?
>>
>> This isssue is not reproducible with Raspbian OS (based on Debian).
>>
>> THX
>> Thomas
>>
Reply to thread Export thread (mbox)