rak6421-13300x* HAT setup is wrong on gpiochip1 #104

Closed
opened 2026-10-27 09:33:25 +01:00 by adam · 8 comments
Owner

The current rak6421-13300x* config for radio-settings.json is set up to use gpiochip1:

    "rak6421-13300x-slot1": {
...
      "use_gpiod_backend": true,
      "gpio_chip": 1

On a Pi4, that's incorrect. I think it might be correct on pi-like devices or on other Pi models like the Pi5?

$ gpioinfo | egrep "^gp|22"
gpiochip0 - 58 lines:
	line  22:	"GPIO22"        	input consumer="periphery"
gpiochip1 - 8 lines:
[The current `rak6421-13300x*` config for radio-settings.json is set up to use gpiochip1](https://github.com/pyMC-dev/pyMC_Repeater/blob/052474cf482ebd3103f5fd7475a95e26c60128f7/radio-settings.json#L268): ``` "rak6421-13300x-slot1": { ... "use_gpiod_backend": true, "gpio_chip": 1 ``` On a Pi4, that's incorrect. I think it might be correct on pi-like devices or on other Pi models like the Pi5? ``` $ gpioinfo | egrep "^gp|22" gpiochip0 - 58 lines: line 22: "GPIO22" input consumer="periphery" gpiochip1 - 8 lines: ``` <!-- github-sync-id:4627966386 -->
adam closed this issue 2026-10-27 09:33:25 +01:00
Author
Owner
I am not sure why the gpio chip has to be selected, but here are the correct settings for that, based on my full testing on Meshtastic: We should be needing the spi / gpio pins not the specific chip. 6421 With 13300 https://github.com/meshtastic/firmware/blob/develop/bin/config.d/lora-RAK6421-13300-slot1.yaml https://github.com/meshtastic/firmware/blob/develop/bin/config.d/lora-RAK6421-13300-slot2.yaml 6421 With 13302 https://github.com/meshtastic/firmware/blob/develop/bin/config.d/lora-RAK6421-13302-slot1.yaml https://github.com/meshtastic/firmware/blob/develop/bin/config.d/lora-RAK6421-13302-slot2.yaml <!-- github-comment-id:4670548475 -->
Author
Owner

pyMC needs the specific pins and the chip- because the pins are connected to the specific chip.

It passes the chip through to pyMC_Core, which uses libgpiod, which requires /dev/gpiochipN to be passed in to gpiod.Chip(chip_path).

the Meshtastic firmware does the same thing, it's wrapped a few layers deeper ( PortduinoGlue->PlatformIO->libgpiod ), but in PortduinoGlue.cpp it passes the chip number through the new LinuxGPIOPin(pinNum, gpioChipName, gpio_name) call, where gpioChipName is gpioChipN.

The difference is the Meshtastic firmware omits the "gpio chip number" config if it's the default chip of 0.

pyMC needs the specific pins and the chip- because the pins are connected to the specific chip. It passes the chip through to pyMC_Core, which uses `libgpiod`, which requires `/dev/gpiochipN` to be passed in to [`gpiod.Chip(chip_path)`](https://github.com/pyMC-dev/pyMC_core/blob/1f4b66e65b27a93552e262c0e0211a34e56340ba/src/pymc_core/hardware/gpio_manager.py#L94). the Meshtastic firmware does the same thing, it's wrapped a few layers deeper ( PortduinoGlue->PlatformIO->libgpiod ), but in PortduinoGlue.cpp it passes the chip number through the [`new LinuxGPIOPin(pinNum, gpioChipName, gpio_name)`](https://github.com/meshtastic/firmware/blob/5d55353939fd38a09230bae89180220f7cb59870/src/platform/portduino/PortduinoGlue.cpp#L722C34-L722C89) call, where gpioChipName is `gpioChipN`. The difference is the Meshtastic firmware omits the "gpio chip number" config if it's the default chip of 0. <!-- github-comment-id:4671504278 -->
Author
Owner

pyMC needs the specific pins and the chip- because the pins are connected to the specific chip.

It passes the chip through to pyMC_Core, which uses libgpiod, which requires /dev/gpiochipN to be passed in to gpiod.Chip(chip_path).

the Meshtastic firmware does the same thing, it's wrapped a few layers deeper ( PortduinoGlue->PlatformIO->libgpiod ), but in PortduinoGlue.cpp it passes the chip number through the new LinuxGPIOPin(pinNum, gpioChipName, gpio_name) call, where gpioChipName is gpioChipN.

The difference is the Meshtastic firmware omits the "gpio chip number" config if it's the default chip of 0.

Awesome, thanks for the explanation.

> pyMC needs the specific pins and the chip- because the pins are connected to the specific chip. > > It passes the chip through to pyMC_Core, which uses `libgpiod`, which requires `/dev/gpiochipN` to be passed in to [`gpiod.Chip(chip_path)`](https://github.com/pyMC-dev/pyMC_core/blob/1f4b66e65b27a93552e262c0e0211a34e56340ba/src/pymc_core/hardware/gpio_manager.py#L94). > > the Meshtastic firmware does the same thing, it's wrapped a few layers deeper ( PortduinoGlue->PlatformIO->libgpiod ), but in PortduinoGlue.cpp it passes the chip number through the [`new LinuxGPIOPin(pinNum, gpioChipName, gpio_name)`](https://github.com/meshtastic/firmware/blob/5d55353939fd38a09230bae89180220f7cb59870/src/platform/portduino/PortduinoGlue.cpp#L722C34-L722C89) call, where gpioChipName is `gpioChipN`. > > The difference is the Meshtastic firmware omits the "gpio chip number" config if it's the default chip of 0. Awesome, thanks for the explanation. <!-- github-comment-id:4671518267 -->
Author
Owner

I had to switch slot1 config to chip0 before it worked. I am on a raspberry pi 4

"rak6421-13300x-slot1": { ... "gpio_chip": 0 }

command sudo gpioinfo showed that my gpio pin 22 was also on gpiochip0

I had to switch slot1 config to chip0 before it worked. I am on a raspberry pi 4 ` "rak6421-13300x-slot1": { ... "gpio_chip": 0 }` command `sudo gpioinfo` showed that my gpio pin 22 was also on gpiochip0 <!-- github-comment-id:4827091447 -->
Author
Owner

I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G.

I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0
Here's what I have in that section:
"rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0
Any tips or maybe I'm missing something.

I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G. I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0 Here's what I have in that section: ` "rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0 ` Any tips or maybe I'm missing something. <!-- github-comment-id:5245671306 -->
Author
Owner

I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G.

I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0 Here's what I have in that section: "rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0 Any tips or maybe I'm missing something.

Are you on the updated version of openhop, and have you selected your radio / etc from the web ui and correct slot ?

> I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G. > > I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0 Here's what I have in that section: `"rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0` Any tips or maybe I'm missing something. Are you on the updated version of openhop, and have you selected your radio / etc from the web ui and correct slot ? <!-- github-comment-id:5245696239 -->
Author
Owner

I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G.
I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0 Here's what I have in that section: "rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0 Any tips or maybe I'm missing something.

Are you on the updated version of openhop, and have you selected your radio / etc from the web ui and correct slot ?

I just installed today on a fresh install of RPi OS Lite 64 bit using command lines found on this repository.
It installed, I got to the web interface once to set things up, and now it won't even go into the web interface.

Running sudo journalctl -u openhop-repeater -f, I get:


Aug 10 13:40:27 MeshCore openhop-repeater[1277]: 2026-08-10 13:40:27,934 - SX1262_wrapper - INFO - SX1262Radio configured: freq=910.5MHz, power=22dBm, sf=7, bw=62.5kHz, pre=32
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: 2026-08-10 13:40:27,934 - GPIOPinManager - ERROR - Failed to setup interrupt pin 22 on /dev/gpiochip1 (backend=gpiod): [Errno 22] Opening input line handle: Invalid argument
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: FATAL: Cannot setup GPIO pin 22 on /dev/gpiochip1 (backend=gpiod)
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: Error: [Errno 22] Opening input line handle: Invalid argument
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: The system cannot function without GPIO access.
Aug 10 13:40:27 MeshCore openhop-repeater[1277]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Main process exited, code=exited, status=1/FAILURE
Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Failed with result 'exit-code'.
Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Consumed 1.192s CPU time.
Aug 10 13:40:33 MeshCore systemd[1]: openhop-repeater.service: Scheduled restart job, restart counter is at 72.
Aug 10 13:40:33 MeshCore systemd[1]: Started openhop-repeater.service - openHop Repeater Daemon.
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,157 - RepeaterDaemon - INFO - Repeater daemon started
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,158 - RepeaterDaemon - INFO - Initializing repeater: pyRpt4089
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,162 - RepeaterDaemon - INFO - System Network IP: 192.168.68.54
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,162 - RepeaterDaemon - INFO - Initializing radio hardware... (radio_type=sx1262)
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,163 - SX1262_wrapper - INFO - SX1262Radio configured: freq=910.5MHz, power=22dBm, sf=7, bw=62.5kHz, pre=32
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,163 - GPIOPinManager - ERROR - Failed to setup interrupt pin 22 on /dev/gpiochip1 (backend=gpiod): [Errno 22] Opening input line handle: Invalid argument
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: FATAL: Cannot setup GPIO pin 22 on /dev/gpiochip1 (backend=gpiod)
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: Error: [Errno 22] Opening input line handle: Invalid argument
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: The system cannot function without GPIO access.
Aug 10 13:40:34 MeshCore openhop-repeater[1283]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Aug 10 13:40:34 MeshCore systemd[1]: openhop-repeater.service: Main process exited, code=exited, status=1/FAILURE
Aug 10 13:40:34 MeshCore systemd[1]: openhop-repeater.service: Failed with result 'exit-code'.

> > I'm not able to get this working. I'm using the 6421 and 13002 on a RPI4 2G. > > I opened the radio-settings.json file under changed slot 1 configuration from "gpio_chip": 1 to "gpio_chip": 0 Here's what I have in that section: `"rak6421-13300x-slot1": { "name": "Rak Wireless RAK6421 with RAK1330x on IO Slot 1", "bus_id": 0, "cs_id": 0, "cs_pin": -1, "reset_pin": 16, "busy_pin": 24, "irq_pin": 22, "txen_pin": -1, "rxen_pin": -1, "en_pins": [12, 13], "txled_pin": -1, "rxled_pin": -1, "tx_power": 22, "use_dio2_rf": true, "use_dio3_tcxo": true, "dio3_tcxo_voltage": 1.8, "preamble_length": 32, "use_gpiod_backend": true, "gpio_chip": 0` Any tips or maybe I'm missing something. > > Are you on the updated version of openhop, and have you selected your radio / etc from the web ui and correct slot ? I just installed today on a fresh install of RPi OS Lite 64 bit using command lines found on this repository. It installed, I got to the web interface once to set things up, and now it won't even go into the web interface. Running sudo journalctl -u openhop-repeater -f, I get: ``` Aug 10 13:40:27 MeshCore openhop-repeater[1277]: 2026-08-10 13:40:27,934 - SX1262_wrapper - INFO - SX1262Radio configured: freq=910.5MHz, power=22dBm, sf=7, bw=62.5kHz, pre=32 Aug 10 13:40:27 MeshCore openhop-repeater[1277]: 2026-08-10 13:40:27,934 - GPIOPinManager - ERROR - Failed to setup interrupt pin 22 on /dev/gpiochip1 (backend=gpiod): [Errno 22] Opening input line handle: Invalid argument Aug 10 13:40:27 MeshCore openhop-repeater[1277]: FATAL: Cannot setup GPIO pin 22 on /dev/gpiochip1 (backend=gpiod) Aug 10 13:40:27 MeshCore openhop-repeater[1277]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Aug 10 13:40:27 MeshCore openhop-repeater[1277]: Error: [Errno 22] Opening input line handle: Invalid argument Aug 10 13:40:27 MeshCore openhop-repeater[1277]: The system cannot function without GPIO access. Aug 10 13:40:27 MeshCore openhop-repeater[1277]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Main process exited, code=exited, status=1/FAILURE Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Failed with result 'exit-code'. Aug 10 13:40:28 MeshCore systemd[1]: openhop-repeater.service: Consumed 1.192s CPU time. Aug 10 13:40:33 MeshCore systemd[1]: openhop-repeater.service: Scheduled restart job, restart counter is at 72. Aug 10 13:40:33 MeshCore systemd[1]: Started openhop-repeater.service - openHop Repeater Daemon. Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,157 - RepeaterDaemon - INFO - Repeater daemon started Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,158 - RepeaterDaemon - INFO - Initializing repeater: pyRpt4089 Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,162 - RepeaterDaemon - INFO - System Network IP: 192.168.68.54 Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,162 - RepeaterDaemon - INFO - Initializing radio hardware... (radio_type=sx1262) Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,163 - SX1262_wrapper - INFO - SX1262Radio configured: freq=910.5MHz, power=22dBm, sf=7, bw=62.5kHz, pre=32 Aug 10 13:40:34 MeshCore openhop-repeater[1283]: 2026-08-10 13:40:34,163 - GPIOPinManager - ERROR - Failed to setup interrupt pin 22 on /dev/gpiochip1 (backend=gpiod): [Errno 22] Opening input line handle: Invalid argument Aug 10 13:40:34 MeshCore openhop-repeater[1283]: FATAL: Cannot setup GPIO pin 22 on /dev/gpiochip1 (backend=gpiod) Aug 10 13:40:34 MeshCore openhop-repeater[1283]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Aug 10 13:40:34 MeshCore openhop-repeater[1283]: Error: [Errno 22] Opening input line handle: Invalid argument Aug 10 13:40:34 MeshCore openhop-repeater[1283]: The system cannot function without GPIO access. Aug 10 13:40:34 MeshCore openhop-repeater[1283]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Aug 10 13:40:34 MeshCore systemd[1]: openhop-repeater.service: Main process exited, code=exited, status=1/FAILURE Aug 10 13:40:34 MeshCore systemd[1]: openhop-repeater.service: Failed with result 'exit-code'. ``` <!-- github-comment-id:5245727538 -->
Author
Owner

It might be easier to troubleshoot this via discord, can you jump on? https://discord.gg/7bz5pZuk8 Openhop's support discord.

It might be easier to troubleshoot this via discord, can you jump on? https://discord.gg/7bz5pZuk8 Openhop's support discord. <!-- github-comment-id:5245746386 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/pyMC_Repeater#104