Skip to content

Commit 6e48fac

Browse files
authored
Merge pull request #11125 from meshtastic/baseui_fixindicator
2 parents 5548bd3 + ef386af commit 6e48fac

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,23 @@ void setup()
11111111
#endif
11121112
#endif
11131113

1114+
#if defined(SENSECAP_INDICATOR)
1115+
// The ST7701 panel shares SCK/MOSI/MISO (41/48/47) with the SX1262, and its host is SPI2_HOST,
1116+
// which on the S3 is the same peripheral as the Arduino `SPI` object (FSPI == SPI2).
1117+
// LovyanGFX bit-bangs the ST7701 init sequence on those pins, and because this variant builds
1118+
// with USE_ARDUINO_HAL_GPIO it does so via Arduino pinMode()/digitalWrite(). pinMode() calls
1119+
// perimanSetPinBus(.., ESP32_BUS_TYPE_GPIO, ..), whose deinit callback (spiDetachBus_SCK) ends
1120+
// up in spiStopBus() and gates the SPI2 clock. RadioLib then spins forever in spiTransferByte()
1121+
// waiting on cmd.update, which never clears on a stopped peripheral, and the watchdog fires.
1122+
//
1123+
// Restart the bus here, after the panel is up and before the radio is touched. Note that
1124+
// SPIClass::begin() early-returns when _spi is already non-NULL, so end() first is required.
1125+
SPI.end();
1126+
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, -1); // CS is an IO-expander pin, driven by RadioLib
1127+
SPI.setFrequency(4000000);
1128+
LOG_DEBUG("SPI2 restarted after ST7701 init (SCK=%d, MISO=%d, MOSI=%d)", LORA_SCK, LORA_MISO, LORA_MOSI);
1129+
#endif
1130+
11141131
auto rIf = initLoRa();
11151132

11161133
lateInitVariant(); // Do board specific init (see extra_variants/README.md for documentation)

0 commit comments

Comments
 (0)