From 242b5db7fa56da604f73b2db30b40d09f6fe6585 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 12 Nov 2026 15:54:21 +0800 Subject: [PATCH] Fix RC52 unused SPI1 MISO pin mapping Use pin index 0, which maps to NRFX_SPIM_PIN_NOT_USED, to avoid the nRF52 SPI constructor indexing g_ADigitalPinMap[255]. Remove the absent MISO shutdown reset so the sentinel cannot reset physical P0.00. Follows the variant-side fixes in #3188 and #3189. Validated heltec_rc52_repeater and heltec_rc52_companion_radio_ble builds. ELF disassembly confirms the MISO lookup uses map[0]=0xFF instead of the +1020-byte read and shutdown has no P0.00 reset. No hardware testing performed. --- variants/heltec_rc52/variant.cpp | 7 +------ variants/heltec_rc52/variant.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/variants/heltec_rc52/variant.cpp b/variants/heltec_rc52/variant.cpp index b9c30863c..a4a090faa 100644 --- a/variants/heltec_rc52/variant.cpp +++ b/variants/heltec_rc52/variant.cpp @@ -10,11 +10,6 @@ const uint32_t g_ADigitalPinMap[] = { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; -static void resetOptionalPin(int pin) -{ - if (pin >= 0) nrf_gpio_cfg_default(pin); -} - void initVariant() { pinMode(PIN_BUTTON1, INPUT_PULLUP); @@ -68,7 +63,7 @@ void variant_shutdown() nrf_gpio_cfg_default(PIN_SPI_MOSI); nrf_gpio_cfg_default(PIN_SPI_SCK); - resetOptionalPin(PIN_SPI1_MISO); + // SPI1 MISO is not connected; its sentinel is not a physical GPIO. nrf_gpio_cfg_default(PIN_SPI1_MOSI); nrf_gpio_cfg_default(PIN_SPI1_SCK); diff --git a/variants/heltec_rc52/variant.h b/variants/heltec_rc52/variant.h index 58036abd6..bd2662fb2 100644 --- a/variants/heltec_rc52/variant.h +++ b/variants/heltec_rc52/variant.h @@ -88,7 +88,7 @@ extern "C" { #define PIN_SPI_MOSI (0 + 22) #define PIN_SPI_SCK (0 + 25) -#define PIN_SPI1_MISO (-1) +#define PIN_SPI1_MISO (0) // g_ADigitalPinMap[0] is 0xFF (NRFX_SPIM_PIN_NOT_USED). #define PIN_SPI1_MOSI PIN_TFT_SDA #define PIN_SPI1_SCK PIN_TFT_SCL