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

Avoid first OTA DFU

I am adding a bootloader with BLE OTA upgrades. I am using SDK 11.0.0 and I based my bootloader in examples\dfu\bootloader. I can only fit a single bank upgrade (I upgrade FW, SD and bootloader, alltogether) so I am using the dfu_single_bank.c file. The example bootloader checks the first byte in BOOTLOADER_SETTINGS_ADDRESS to know whether there is a valid application loaded in the flash and whether to start it or not. That byte is not initialized so by default is 0 and the bootloader starts in DFU mode.

I did as suggsted in an answer here and I changed the following line:

 uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) ;

to:

uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};

That way I can flash the SD, bootloader and application with nRFGO and the first time the bootloader boots it starts the application.

The problem now is that DFU never actually starts. When I try it from the Android app, the phone connects. But when DFU starts, my device resets and the application on the nrf52832 starts (I guess the bootloader starts and then it starts the application).

I have no further information as I am still trying to undestand it fully. Anyway has anyone came accross this problem and is there any better way to avoid this first OTA DFU so that when the app+bootloader are flashed from nRFGO the application starts straight away?

Parents
  • Could you debug your bootloader and check the value of the dfu_start variable when you reach the

    if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)))
    

    statement? It should be set to true if you enter the bootloader via your application, i.e. you write to the GPREGRET register in your application and then branch to the bootloader. In the bootloader the dfu_start variable is set as follows

    dfu_start  = app_reset;
    app_reset = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_START);
    
Reply
  • Could you debug your bootloader and check the value of the dfu_start variable when you reach the

    if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)))
    

    statement? It should be set to true if you enter the bootloader via your application, i.e. you write to the GPREGRET register in your application and then branch to the bootloader. In the bootloader the dfu_start variable is set as follows

    dfu_start  = app_reset;
    app_reset = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_START);
    
Children
No Data
Related