MCUBOOT Serial recovery not started on soft reboot

Hi,

I've successfully incorporated MCUBOOT into software we developed for the nRF5340. I'm also able to start serial-recovery by activating a GPIO, reserved for this purpose, when the system powers up. However, when I reboot the system from software (using sys_reboot) the GPIO is ignored and normal operation resumes instead of again entering serial-recovery mode. I also tried using the watchdog to do a 'hard' reboot but that also doesn't work. The only way I can get it to work is by performing a proper hard-reset. However, the system has a battery backup (so I can't cycle the power) and there is no hardware reset mechanism.

How can I get the nRF5340 to enter serial recovery mode after performing a soft-reboot or a watchdog timer reboot? 

Thanks,

Uwe

Parents
  • I think I can answer my own question: upon reboot, it will only enter serial recovery if the elected GPIO is active and !io_boot_skip_serial_recovery(). If we dig down into io_boot_skip_serial_recovery() we see that it will only return false on 1. power on reset or 2. brown-out reset or 3. reset pin. So, as it stands, a soft-reset or watchdog reset will cause it to bypass serial recovery. Why this was designed so is a mystery to me at the moment.

    static inline bool io_boot_skip_serial_recovery()
    {
        uint32_t rr = nrfx_reset_reason_get();
        return !(rr == 0 || (rr & NRFX_RESET_REASON_RESETPIN_MASK));
    }
Reply
  • I think I can answer my own question: upon reboot, it will only enter serial recovery if the elected GPIO is active and !io_boot_skip_serial_recovery(). If we dig down into io_boot_skip_serial_recovery() we see that it will only return false on 1. power on reset or 2. brown-out reset or 3. reset pin. So, as it stands, a soft-reset or watchdog reset will cause it to bypass serial recovery. Why this was designed so is a mystery to me at the moment.

    static inline bool io_boot_skip_serial_recovery()
    {
        uint32_t rr = nrfx_reset_reason_get();
        return !(rr == 0 || (rr & NRFX_RESET_REASON_RESETPIN_MASK));
    }
Children
No Data
Related