diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index f7b3a7d9a..f120d387c 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -378,7 +378,11 @@ void nrf52Setup() pinMode(ADC_V, INPUT); #endif - uint32_t why = NRF_POWER->RESETREAS; + // The Adafruit core's init() (cores/nRF5/wiring.c) caches RESETREAS into a static and then + // W1C-clears the hardware register before setup() ever runs, so a raw NRF_POWER->RESETREAS + // read here is ALWAYS 0. Use the core's cached copy so this log line is actually meaningful + // (0x1 pin reset, 0x2 watchdog, 0x4 soft reset/SREQ, 0x8 CPU lockup, 0x10000 System OFF wake). + uint32_t why = readResetReason(); // per // https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html LOG_DEBUG("Reset reason: 0x%x", why); diff --git a/variants/nrf52840/nrf52.ini b/variants/nrf52840/nrf52.ini index 76e3191b4..f989a48a4 100644 --- a/variants/nrf52840/nrf52.ini +++ b/variants/nrf52840/nrf52.ini @@ -23,6 +23,13 @@ build_flags = ${arduino_base.build_flags} -Wno-unused-variable -Isrc/platform/nrf52 + ; The Arduino loop task runs the entire cooperative OSThread scheduler; the core's stock + ; 4 KB (1024-word) stack overflows during BLE first-sync (admin config-apply -> radio + ; reconfigure with XEdDSA/satmap/log frames stacked) - SWD-proven on T1000-E: SP driven + ; 40 B below pxStack, corrupting adjacent heap -> silent HardFault reset on phone pairing. + ; 2048 words = 8 KB, validated on hardware. Value is in WORDS; requires the #ifndef guard + ; from meshtastic/Adafruit_nRF52_Arduino#7 (harmless redefinition warning until it merges). + -DLOOP_STACK_SZ=2048 -DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818 -DMESHTASTIC_EXCLUDE_AUDIO=1 -DMESHTASTIC_EXCLUDE_PAXCOUNTER=1