Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ESP32: rtc_gpio_hold_en() called on non-RTC GPIO18 during LilyGO repeater shutdown

Open
#3,586 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
embedded-iot

Research direction

Read src/helpers/ESP32Board.cpp and variants/lilygo_tlora_v2_1/platformio.ini to trace ESP32Board::enterDeepSleep() and confirm the NSS pin definition. Check the ESP-IDF GPIO documentation for the hold API supported by the target ESP32 variant. Done means deep sleep no longer calls an RTC-only API for GPIO18; verify the behavior on the affected hardware if available.

Written by the indexing model from the issue text.

Description

While helping another user troubleshoot a LilyGO LoRa32 V2.1-1.6 repeater (ESP32, 433 MHz variant), I came across an invalid RTC GPIO call in the deep-sleep code.

Observed behavior

A custom Repeater build based on commit a366955cb2f67b8e6842d4f00d2b6a554dddd88a booted successfully, then entered the power-off sequence and produced this log:

Repeater ID: <redacted>
Powering Off
E (5387) RTCIO: rtc_gpio_hold_en(153): RTCIO number error

The build used a different radio frequency and LoRa reset pin, but the NSS pin definition and deep-sleep implementation were unchanged from upstream.

Cause

The LilyGO profile defines:

-D P_LORA_NSS=18

On the original ESP32, ESP32Board::enterDeepSleep() calls:

rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);

GPIO18 is not RTC-capable on the original ESP32, so rtc_gpio_hold_en() returns ESP_ERR_INVALID_ARG.

The 153 in the error message is an ESP-IDF source line number, not a GPIO number.

The call is also present in the current upstream main branch.

Expected behavior

The deep-sleep code should not call an RTC-only API for a regular GPIO.

If keeping NSS high during deep sleep is required, the appropriate GPIO hold mechanism should be used for the target ESP32 variant.

Scope of testing

I traced the shutdown path in the source and checked it against the captured UART log.

The power-off event itself appears to originate from the GPIO0 long-press handler. Its electrical cause has not been established.

The invalid RTC GPIO call explains the subsequent RTCIO error, not the original power-off event.

I have not reproduced this on an unmodified stock firmware binary or verified a fix on the affected hardware.

References
Dominant language
C
Stars
3.9k
Forks
1.5k
Avg merge
1d 3h
Merged PRs (30d)
24

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshcore-dev/MeshCore

All issues in meshcore-dev/MeshCore

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.