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

Buttonless DFU using BLE

Hello,

I have application that is sending data over BLE every 5 minutes.

I want to implement DFU using BLE. I don't have any single button on my device.

What should i have to add in my application for DFU. I use native nRF boot-loader from example. What are the changes i have to do in native Bootloader for buttonless DFU.

How to tell my application to jump into DFU mode ? 

Thanks.

  • Hello ,

    This thread is more than a year old and the customer has stopped replying.
    Please create a new ticket detailing the issue you are experiencing, if you require help.

    Best regards,
    Karl

  • Hello, it's been a long time since you posted these questions but the answer is:

    STEP 1. be sure that in the code "secure_bootloader" the macro NRF_BL_DFU_ENTER_METHOD_GPREGRET located in sdk_config.h file been equal to 1.

    STEP 2. in your main application if you want to jump to DFU mode you have to execute the next code:


    sd_power_gpregret_clr(0, 0xFF)
    NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
    // Signal that DFU mode is to be enter to the power management module
    nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);

    wherethe value of those macros is:

    #define BOOTLOADER_DFU_GPREGRET_MASK (0xB0)
    #define BOOTLOADER_DFU_START_BIT_MASK (0x01)
    #define BOOTLOADER_DFU_START (BOOTLOADER_DFU_GPREGRET_MASK | BOOTLOADER_DFU_START_BIT_MASK)

    /**@brief Power management shutdown types. */
    typedef enum
    {
    NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF,
    //!< Go to System OFF.

    NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF,
    //!< Go to System OFF and stay there.
    /**<
    * Useful when battery level is dangerously low, for example.
    */

    NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU,
    //!< Go to DFU mode.

    NRF_PWR_MGMT_SHUTDOWN_RESET,
    //!< Reset chip.

    NRF_PWR_MGMT_SHUTDOWN_CONTINUE
    //!< Continue shutdown.
    /**<
    * This should be used by modules that block the shutdown process, when they become ready for
    * shutdown.
    */
    } nrf_pwr_mgmt_shutdown_t;

    Also you have to include the nexts files:

    #include "nrf_soc.h"

    #include "nrf_power.h"

    and that's all. When the application execute the line nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU); it will execute a system reset so the bootloader will read the NRF_POWER->GPREGRET register and will jump to DFU mode.

    NOTE: The NRF_POWER->GPREGRET register is cleared when a hardware reset occurs. therefore if you turn off you device then you turn on it will start in your main application becose the register will be equal to 0.

  • Hello,

    Thank you for providing us with an update on this, Hector! :) 
    I assume that brijeshgpt47 created a separate ticket for this, but its great to have your comment here for completeness / future reference.

    Best regards,
    Karl

Related