Skip to content

RuntimeError: Failed to add edge detection #34

@noeldum

Description

@noeldum

On a fresh install of Bookworm on a pi3 I run into a funny python error.

RuntimeError: Failed to add edge detection

Both the script and hardware that I am running were used on a different setup and working pretty well on Bullseye OS. Therefore they are not to be blamed here.
I am happy to question my OS setup of Bookworm. SPI has been enabled with raspi-config.

This is my very simple script

from RFM69 import Radio, FREQ_315MHZ, FREQ_433MHZ, FREQ_868MHZ, FREQ_915MHZ

node_id = 2
network_id = 0

board = {'isHighPower': True, 'encryptionKey': "TOPSECRETPASSWRD"}

with Radio(FREQ_433MHZ, node_id, network_id, verbose=False, **board) as radio:

    while True:
        # This call will block until a packet is received,
        packet = radio.get_packet(timeout = 10)

        # If radio.get_packet times out, it will return None
        if packet is None:
            print("No packet received in the last 10 seconds")
        else:
            # Process packet
            print (packet)

Running this gets us the error below

/usr/local/lib/python3.11/dist-packages/RFM69/radio.py:115: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(self.rstPin, GPIO.OUT)
Traceback (most recent call last):
  File "/home/pi/rx.py", line 8, in <module>
    with Radio(FREQ_433MHZ, node_id, network_id, verbose=False, **board) as radio:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/RFM69/radio.py", line 87, in __init__
    self._initialize(freqBand, nodeID, networkID)
  File "/usr/local/lib/python3.11/dist-packages/RFM69/radio.py", line 106, in _initialize
    self._init_interrupt()
  File "/usr/local/lib/python3.11/dist-packages/RFM69/radio.py", line 148, in _init_interrupt
    GPIO.add_event_detect(self.intPin, GPIO.RISING, callback=self._interruptHandler)
RuntimeError: Failed to add edge detection

Hardware is all wired to use defaults from the library. It has been well tested before on Bullseye.

Any ideas how to solve this?

ARe there any plan to port this library to the new gpio management system? Looks like Rpi.GPIO is getting obsolete now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions