This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

usb dfu bootloader with GPREGRET entrance Cause cannot get out the bootloader mode

hi,

I am working with usb dfu bootloader for nrf52833. I set the bootloader entrance mode to GPREGRET only. before enter bootloader, I set NRF_POWER->GPREGRET = 0x00000001, and I can enter the bootloader mode without problems. but after timeout reboot and flash finished reboot, the chip does not switch to application mode, it stay in bootloader mode. but it works for nrf52832. I know GPREGRET will reset when power off, but in my case, I cannot do that. is there any way I can get out of bootloader mode?

Parents
  • Hi,

    The function dfu_enter_flags_clear() should clear the GPREGRET BOOTLOADER_DFU_START field. You should use the debug variant of the bootloader, debug and check why the app won't start. It could be wrong CRC, wrong SoftDevice version used, etc.

    What nrfutil command did you use to generate the DFU package?

    What SDK version are you using? What SoftDevice version are you using ?

Reply
  • Hi,

    The function dfu_enter_flags_clear() should clear the GPREGRET BOOTLOADER_DFU_START field. You should use the debug variant of the bootloader, debug and check why the app won't start. It could be wrong CRC, wrong SoftDevice version used, etc.

    What nrfutil command did you use to generate the DFU package?

    What SDK version are you using? What SoftDevice version are you using ?

Children
  • <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <debug> app: DFU mode requested via GPREGRET.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x2000002C)
    <debug> app: timer_activate (0x2000002C)
    <info> app: Entering DFU mode.
    <info> app: BOOTLOADER INIT
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_serial_usb: Initializing drivers.
    <debug> nrf_dfu_serial_usb: Starting USB
    <debug> nrf_dfu_serial_usb: USB Transport initialized
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Enter main loop
    <info> nrf_dfu_serial_usb: USB power detected
    <info> nrf_dfu_serial_usb: USB ready

    feels like the GPREGRET is not cleaned.

  • this cause clear gpregret never happened 

    if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &&
    ((nrf_power_gpregret_get() & BOOTLOADER_DFU_GPREGRET_MASK) == BOOTLOADER_DFU_GPREGRET)
    && (nrf_power_gpregret_get() & BOOTLOADER_DFU_START_BIT_MASK))
    {
    // Clear DFU mark in GPREGRET register.
    nrf_power_gpregret_set(nrf_power_gpregret_get() & ~BOOTLOADER_DFU_START);
    }

    I have no idea what should I set to NRF_POWER->GPREGRET, I tried 0x00000001 and 0xF8 | 0x01, and nothing changed

  • I found the issue, I must to set the flag to 0xB1 to make it work

Related