fix: warn of radio pins that can stop the board booting (#34)

GPIO12 is a strapping pin on the original ESP32: high at reset, it powers
the flash at 1.8 V. A CC1101 can hold GDO2 high at power-up, so a board
with RX on 12 bootloops after a power cut until EN is pressed. It was the
default RX pin.

- RX defaults to GPIO35 on the original ESP32. Saved settings keep their
  pins.
- The log warns each time the radio starts, and the radio settings show a
  warning, while TX, RX or MISO is on a pin whose level at reset can stop
  the chip booting (src/BootPins.h, data-src/js/pins.js).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-29 22:29:39 +01:00
parent a92c7a26f6
commit 8a59f51111
10 changed files with 234 additions and 7 deletions

34
src/BootPins.h Normal file
View file

@ -0,0 +1,34 @@
#ifndef BOOT_PINS_H
#define BOOT_PINS_H
#include <stdint.h>
#if __has_include(<sdkconfig.h>)
#include <sdkconfig.h>
#endif
// The strapping pins whose level at reset can keep the chip from starting
// the firmware. The ROM reads them before any code runs, so a radio that
// drives one at power-up stops the board booting until EN is pressed (issue
// #34). The strapping pins that only pick a download mode, quiet the boot
// log or set the SDIO timing aren't listed. web UI: data-src/js/pins.js.
//
// Returns what the pin does at reset, or nullptr for a pin that can't stop
// the boot.
inline const char *bootPinEffect(uint8_t pin) {
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
if(pin == 0) return "low at reset starts the download mode";
if(pin == 45) return "high at reset powers the flash at 1.8 V";
#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
if(pin == 9) return "low at reset starts the download mode";
#elif defined(CONFIG_IDF_TARGET_ESP32C5)
if(pin == 28) return "low at reset starts the download mode";
#elif defined(CONFIG_IDF_TARGET_ESP32P4)
if(pin == 35) return "low at reset starts the download mode";
#else
// The original ESP32. MTDI picks the flash voltage unless the
// VDD_SDIO efuses are burned.
if(pin == 0) return "low at reset starts the download mode";
if(pin == 12) return "high at reset powers the flash at 1.8 V";
#endif
return nullptr;
}
#endif