Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5288

Python • Re: GPIO.wait_for_edge >>> RuntimeError: Error waiting for edge

$
0
0
i can confirm that GPIO.wait_for_edge() does not work in RPi5 but used to work in RPi4.
What I see is somewhat different - function never returns despite there being an edge on the port pin. This has been confirmed by polling the pin value. Setting a timeout value does make it return but only with timeout's. The library GPIO is using lgpio

Code:

import RPi.GPIO as GPIO chan  = GPIO.wait_for_edge(self.BUTTON_GPIO_ALARM, GPIO.RISING, timeout=5000) if chan is None:         logger.info('Timeout GPIO.wait_for_edge occurred') else:        logger.info('Edge detected on{chan=} ')
I dont see the same runTimeError but in stead occasional:

Code:

    chan  = GPIO.wait_for_edge(self.BUTTON_GPIO_ALARM, GPIO.RISING, timeout=5000)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/hl/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 803, in wait_for_edge    alert = _set_alert(gpio, mode, edge, bouncetime)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/hl/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 309, in _set_alert    _check(lgpio.gpio_claim_alert(_chip, gpio, {           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/usr/lib/python3/dist-packages/lgpio.py", line 1294, in gpio_claim_alert    return _u2i(_lgpio._gpio_claim_alert(           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i    raise error(error_text(v))lgpio.error: 'bad event request'
These are the libraries installed whith names *gpio*
  • gpiozero==2.0
    lgpio==0.2.2.0
    pigpio==1.78
    rpi-lgpio==0.6
Wonder if some are in conflict. Can it be related to the new hardware implementation in pi5 relative to pi4?

$ uname -a
Linux pi96 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux

Statistics: Posted by h.larsen — Mon May 20, 2024 10:19 pm



Viewing all articles
Browse latest Browse all 5288

Trending Articles