RealmSwitch 6 Not Responding: How an Old GPIO Service Hijacked Raspberry Pi UART

An ESP32-C3 stopped responding to Raspberry Pi UART commands because an obsolete McLaren LED service was claiming GPIO14. Here’s how we diagnosed and fixed it.

A small but frustrating fault on my Raspberry Pi 4, NoobSaibot, left an ESP32-C3 controller (RealmSwitch 6) apparently unresponsive. The ESP32 could boot and connect to Wi-Fi and MQTT, but commands sent over the Pi’s UART returned nothing. The cause turned out to be an old LED service reconfiguring the UART transmit pin.

Symptoms

  • realmswitch PING and realmswitch STATUS initially returned No reply from RealmSwitch 6.
  • Pressing RESET on the ESP32 produced its boot output via /dev/serial0, so the ESP32-to-Pi receive path worked.
  • Sending commands with Python’s serial module also returned empty responses.

Finding the GPIO conflict

The Pi’s serial alias was correct: /dev/serial0 -> ttyAMA0, and no process appeared to have the device open. But checking the pins revealed the actual fault:

sudo raspi-gpio get 14-15
# GPIO 14: func=OUTPUT
# GPIO 15: func=RXD0

GPIO14 should have been configured for TXD0 (ALT0), not as a general-purpose output. GPIO15 was already correctly configured for RXD0.

Immediate recovery

sudo pinctrl set 14 a0
realmswitch STATUS

The status command immediately worked, showing WIFI=1, MQTT=1 and the ESP32’s LAN address. The PING command returned ERR UNKNOWN COMMAND: PING: this was a useful sign of two-way communication, rather than a supported PING function in the current firmware.

Root cause

An older systemd service, mclaren-controller.service, was still active even though the McLaren lighting had been moved to the ESP32 controller. Searching its Python code revealed:

LED_PIN = 14
GPIO.setup(LED_PIN, GPIO.OUT)
pwm = GPIO.PWM(LED_PIN, PWM_FREQUENCY)

That script claimed the very same GPIO14 pin the Pi was using to transmit UART commands. The Pi’s boot configuration already had enable_uart=1 and dtoverlay=disable-bt, so the problem was not missing UART setup.

Permanent corrective action

As the old McLaren GPIO controller was obsolete, I disabled it and restored the UART pin:

sudo systemctl disable --now mclaren-controller.service
sudo pinctrl set 14 a0
systemctl is-enabled mclaren-controller.service
systemctl is-active mclaren-controller.service
realmswitch STATUS

The service reported disabled and inactive, and RealmSwitch continued responding. I left pigpiod and the other active lighting services alone, since their presence by itself did not establish a conflict.

Lessons learned

  • A boot log proves that data can travel from the ESP32 to the Pi, not necessarily the other way around.
  • Check pin multiplexing with pinctrl get 14 and pinctrl get 15 when UART mysteriously fails.
  • Retire obsolete GPIO services when moving hardware functions to a microcontroller.
  • Check both systemd services and Python pin assignments before changing firmware or wiring.

Verification note: Communication and service shutdown were confirmed immediately. A subsequent reboot test is still recommended to verify the UART stays assigned correctly after startup.