From 2a76a5527a915bc3b2f6b24651e8cd0ee765a9fe Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 25 Apr 2022 01:48:28 -0500 Subject: [PATCH] Fix execution halt in nrf devices on assert and add --reboot support on nrf (#1397) * Fix execution halt in nrf devices on assert * Peg espressif platform to 3.5.0 * Add reboot to nrf52 devices --- platformio.ini | 2 +- src/main.cpp | 2 ++ src/nrf52/main-nrf52.cpp | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index c0b4787b8..45fd71d55 100644 --- a/platformio.ini +++ b/platformio.ini @@ -121,7 +121,7 @@ lib_deps = ; Common settings for ESP targes, mixin with extends = esp32_base [esp32_base] extends = arduino_base -platform = espressif32 +platform = espressif32@3.5.0 src_filter = ${arduino_base.src_filter} - upload_speed = 921600 diff --git a/src/main.cpp b/src/main.cpp index c49201e83..d3804ef2c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -714,6 +714,8 @@ void powerCommandsCheck() #ifndef NO_ESP32 DEBUG_MSG("Rebooting for update\n"); ESP.restart(); +#elif NRF52_SERIES + NVIC_SystemReset(); #else DEBUG_MSG("FIXME implement reboot for this platform"); #endif diff --git a/src/nrf52/main-nrf52.cpp b/src/nrf52/main-nrf52.cpp index bcf354024..c4c0880bb 100644 --- a/src/nrf52/main-nrf52.cpp +++ b/src/nrf52/main-nrf52.cpp @@ -32,8 +32,8 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c { DEBUG_MSG("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr); // debugger_break(); FIXME doesn't work, possibly not for segger - while (1) - ; // FIXME, reboot! + // Reboot cpu + NVIC_SystemReset(); } void getMacAddr(uint8_t *dmac) @@ -193,4 +193,4 @@ void clearBonds() { nrf52Bluetooth->setup(); } nrf52Bluetooth->clearBonds(); -} \ No newline at end of file +}