CircuitPython version
Adafruit CircuitPython 8.0.0-beta.0-56-g3969580319-dirty on 2022-09-29; Aulitech Cato with nRF52840
Reproduced on 7.3.3 with Seeed XIAO nrf52840 BLE SENSE
Code/REPL
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.UF2)
Behavior
The board resets immediately instead of at the next reset. It enters safe mode instead of launching bootloader. This is similar to open issue number #5353.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Nordic system firmware failure assertion.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Description
I believe the only time the save mode boot text "Nordic system firmware failure assertion." occurs is when called from ports/nrf/common-hal/_bleio/Adapter.c:
STATIC void softdevice_assert_handler(uint32_t id, uint32_t pc, uint32_t info) {
reset_into_safe_mode(NORDIC_SOFT_DEVICE_ASSERT);
}
The implementation of microcontroller.on_next_reset() is in ports/nrf/common-hal/microcontroller/init.c:
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
enum { DFU_MAGIC_UF2_RESET = 0x57 };
if (runmode == RUNMODE_BOOTLOADER) {
NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET;
} else {
NRF_POWER->GPREGRET = 0;
}
if (runmode == RUNMODE_SAFE_MODE) {
safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
}
}
Is there anyway setting NRF_POWER->GPREGRET results in triggering softdevice_assert_handler()? I don't believe safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE) is getting called because the start up text doesn't match.
Additional information
No response
CircuitPython version
Code/REPL
Behavior
The board resets immediately instead of at the next reset. It enters safe mode instead of launching bootloader. This is similar to open issue number #5353.
Description
I believe the only time the save mode boot text "Nordic system firmware failure assertion." occurs is when called from ports/nrf/common-hal/_bleio/Adapter.c:
The implementation of microcontroller.on_next_reset() is in ports/nrf/common-hal/microcontroller/init.c:
Is there anyway setting NRF_POWER->GPREGRET results in triggering softdevice_assert_handler()? I don't believe safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE) is getting called because the start up text doesn't match.
Additional information
No response