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

DFU

Hi,

I expected a bit more fanfare for the BLE-based DFU, but eventually found it in the 4.4 SDK after my sales rep told me it was there ;)

Some questions:

(1) Is there a plan to support DFU over BLE without the need to physically press a button? I get that this could be user implemented, but for something as critical as DFU, we'd rather rely on the vendor's code.

(2) Will there be a sample iOS app any time soon?

Thanks!

-m

  • You should have received an e-mail that there was an SDK update, but that doesn't yet include any changelog, so I see it wasn't easy to know. :)

    Anyway:

    1. I can report it as a feature request, but it should be fairly straightforward to add. I think the easiest methods would be to use the GPREGRET register. Write a special value when you want to jump to the bootloader, and just reset. Change the bootloader so that your special value is also considered a reason for staying in bootloader mode.

    Another option would actually be to include the bootloader service and its dependencies in your application, so that you just stay in application mode while doing the download and then reset only when finished and verified. This would also require some changes to the bootloader though.

    1. This is definitely something we wish to do, but there hasn't been set any dates for it yet, so I can't promise anything.
  • Hi Ole! Long time, no speak :)

    1. If you can report that as a feature request, that'd be great. For those of us building "appcessories", the thought of having to include a) a button b) have the user press it to update the firmware is scary.

    I'll have our developer try what you suggested.

    1. Looking forward to the demo code.

    Thanks for the super-swift response. I'm starting to wonder if a big "N" gets projected in the sky when there's a question that you could answer, and then you rush to your computer to respond when you see it ;)

    Cheers,

    -m

  • I did a small test and it´s working. Don´t know if it´s the best solution but it works for me.

    Change this in the bootloader app. it will still trigger on button 7 put it´s easy to take away.

        if (bootloader_is_pushed || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)) || NRF_POWER->GPREGRET == 1)
        {
            nrf_gpio_pin_set(LED1);
    	NRF_POWER->GPREGRET = 0;
            // Initiate an update of the firmware.
            err_code = bootloader_dfu_start();
            APP_ERROR_CHECK(err_code);
    
            nrf_gpio_pin_clear(LED1);
        }
    

    Add this in your normal code for tigger bootloader NRF_POWER->GPREGRET = 1; NVIC_SystemReset();

  • I wish I could accept two answers...that's awesome, Jörgen!! :D

    -m

  • I tried as you said, but it is not working. I just modified the ble_app_hrs code as follows, static void on_write(ble_evt_t * p_ble_evt) { ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; if (p_evt_write->handle == 3)
    { NRF_POWER->GPREGRET = 1; sd_nvic_SystemReset(); }

    when i update the device name, it should set the register and reset the device, then the bootloader mode will take place. I also modified the bootloader code as you said. while debugging i can see that the device enters into the bootloader mode, when reset happens. but, when testing with the master control pannel, system reset happens, but it is not entering into the bootloader mode. could you please help me get over this. and also tell me the source file location from where you are entering into the bootloader mode(i.e location to set NRF_POWER->GPREGRET == 1).

Related