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

buttonless DFU

Hi ! 

I'm setting up buttonless DFU on an nrf52832. I'm using SES on windows. 

I found two ways of performing it, one in the forum and another in the infocenter.

The first way is using those command found on the Dev Zone that are supposed to restart in DFU mode : 

I would like to know where I could find the reference (.h) to the BOOTLOADER_DFU_START and to BOOTLOADER_DFU_SKIP_CRC

The other way i found is to use NRF_BL_DFU_ENTER_METHOD_BUTTONLESS. I would like to know how to switch the boolean mentionned in this infocenter link .

Thanks !

Jerome

  • Hello Jerome,

     

    I would like to know how to switch the boolean mentionned in this infocenter link .

     Not sure what you tried to link to. Please note that infocenter doesn't update the URL when you click links. Also, the link is corrupted once you open it for some reason. Right click on the link to what you want to link to and select "copy link". 

    As you say, yes. There are several ways to enter DFU mode. The easiest is probably to include the buttonless_dfu service pretty much as is, and it will handle the registers that the bootloader will check when it boots up. That being said, I have never checked exactly what it does. It mostly just works.

    Another way is to use the GPREGRET . What to write to this register is probably based on the SDK version. I'll use 16.0.0 as an example:

    See dfu_enter_check() in the bootloader project (found in nrf_bootloader.c)

        if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &&
           (nrf_power_gpregret_get() & BOOTLOADER_DFU_START))
        {
            NRF_LOG_DEBUG("DFU mode requested via GPREGRET.");
            return true;
        }

    BOOTLOADER_DFU_START is defined in nrf_bootloader_info.h:

    #define BOOTLOADER_DFU_START    (BOOTLOADER_DFU_GPREGRET | BOOTLOADER_DFU_START_BIT_MASK)

    Which gives:

    0xB1.

    So if you write 0xB1 to GPREGRET it will enter DFU mode when the device resets.

    Please note that writing to registers may take some time, so you can't write and reset immediately after. Use something like this:

    nrf_power_gpregret_set(0xB1);
    while ((nrf_power_gpregret_get() & 0xB1) != 0xB1)
    {
        // Wait.
    }
    NVIC_SystemReset();

    Best regards,

    Edvin

  • Thanks for your answer Edvin.

    The link I was mentionning is the bootloader settings configuration found at Software Development Kit > nRF5 SDK v17.0.0 > API Reference > SDK common libraries > Bootloader modules (the link is corrupted when I paste it).  I can see there is a macro called NRF_BL_DFU_ENTER_METHOD_BUTTONLESS for which it says I have to enable the buttonless DFU by setting the enter_buttonless_dfu boolean to 1.

    I'm guessing it's what you mean by "The easiest is probably to include the buttonless_dfu service pretty much as is"

    My question is how do I set it to 1 ? I'm trying to follow the buttonless secure dfu service page. I would like to know in which part of the code do I need to make the changes. My bootloader, the application, another specific bootloader .. ?

  • Setting it to 1 would be done from the central. Try to connect to it with nRF Connect for Android/iOS/Desktop and write 01 to this characteristic. You should see that it will disconnect and start advertising as DFU targ (if a bootloader is flashed).

  • Hi Edvin, 

    I was able to perform buttonless DFU by using the example found in SDK16.0.0\examples\ble_peripheral\ble_app_buttonless_dfu\pca10040\s132\ses 

    I am now at the stage of implementing the content of this example in my main app. 

    The only problem is that nrf Connect on windows never succed the DFU, while nrfToolbox on my iPhone with the exact same .zip file works just fine..

    I get this error message on windows : 

    Thanks for your support

    Jerome

  • What nRF Connect for Desktop version do you use, and how do you perform the DFU with the application image? Do you use the same image as you use on the phone? And are you sure the bootloader will accept the FW at this point in time? Perhaps you already updated the FW from the phone?

    I have a few questions:

    1. How you generate the dfu application image?

    2. Do you press the DFU image directly, or do you write to the buttonless service first?

    3. Did you do any changes to the bootloader project? (applied bonding requirements? Other changes?)

    4. What HW are you running on?

    5. Have you tried the pca10040_s132_ble_debug project? Does the log from the bootloader project say anything when this issue occurs?

Related