You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'm not 100% sure if the bootloader in Espruino supports looking at that register but it's worth a try...

    There's nothing built in to Espruino though I'm afraid, but if it works maybe we should add it!

  • There's nothing built in to Espruino though I'm afraid, but if it works maybe we should add it!

    Well, I proposed that previously but so far your argument was that it is dangerous - someone with access to console can remotely update your device so something physical (holding button) to enter DFU is safer.

    Some watches uses also value 1 in GPREGRET to trigger DFU so in my custom builds I have one liner

    --- a/targets/nrf5x_dfu/main.c
    +++ b/targets/nrf5x_dfu/main.c
    @@ -149,18 +153,19 @@ bool nrf_dfu_enter_check(void) {
     bool dfu_enter_check(void) {
     [#endif](https://forum.espruino.com/sear­ch/?q=%23endif)
       bool dfu_start;
    +  if (NRF_POWER->GPREGRET == 1) { NRF_POWER->GPREGRET=0; return true; }
     [#ifdef](https://forum.espruino.com/sear­ch/?q=%23ifdef) BTN1_PININDEX
       dfu_start = get_btn1_state();
     [#else](https://forum.espruino.com/searc­h/?q=%23else)
    

    but I agree that it is somewhat dangerous.
    With that one liner in bootloader you enter DFU by poke32(0x4000051c,1), with softdevice enabled it automatically reboots (into DFU)

About

Avatar for Gordon @Gordon started