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

chip doesn't enter in dfu mode

Hello!

DFU works correctly.

I try to enter chip in dfu mode from application by receiving command from SPI.

When command is received:

{
sd_softdevice_disable();
// Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);
NVIC_SystemReset();
break;
}

device is resetting. but doesn't enter in dfu mode. How can it be entered in dfu?

Parents
  • It is solved.

    It was needed to write two registers:
    nrf_power_gpregret_set(BOOTLOADER_DFU_START);
    nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);

    Is it normal to make it not in state observer function (as in the example)?

    just in parsing SPI command function?

  • Thanks for the update. "nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);" is actually not needed for entering DFU. It's used to skip CRC boot validation of the app on subsequent boot and is mainly used for enabling faster startup from System OFF mode.

    Here's how we have implemented the buttonless mechanism for our BLE service for reference:

    uint32_t ble_dfu_buttonless_bootloader_start_finalize(void)
    {
        uint32_t err_code;
    
        NRF_LOG_DEBUG("In ble_dfu_buttonless_bootloader_start_finalize\r\n");
    
        err_code = sd_power_gpregret_clr(0, 0xffffffff);
        VERIFY_SUCCESS(err_code);
    
        err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        VERIFY_SUCCESS(err_code);
    
        // Indicate that the Secure DFU bootloader will be entered
        m_dfu.evt_handler(BLE_DFU_EVT_BOOTLOADER_ENTER);
    
        // Signal that DFU mode is to be enter to the power management module
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
    
        return NRF_SUCCESS;
    }

Reply
  • Thanks for the update. "nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);" is actually not needed for entering DFU. It's used to skip CRC boot validation of the app on subsequent boot and is mainly used for enabling faster startup from System OFF mode.

    Here's how we have implemented the buttonless mechanism for our BLE service for reference:

    uint32_t ble_dfu_buttonless_bootloader_start_finalize(void)
    {
        uint32_t err_code;
    
        NRF_LOG_DEBUG("In ble_dfu_buttonless_bootloader_start_finalize\r\n");
    
        err_code = sd_power_gpregret_clr(0, 0xffffffff);
        VERIFY_SUCCESS(err_code);
    
        err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        VERIFY_SUCCESS(err_code);
    
        // Indicate that the Secure DFU bootloader will be entered
        m_dfu.evt_handler(BLE_DFU_EVT_BOOTLOADER_ENTER);
    
        // Signal that DFU mode is to be enter to the power management module
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
    
        return NRF_SUCCESS;
    }

Children
Related