Hi,
I'd like to update firmware on my nRF52832 panel with my update flow (only the application; the bootloader and softdevice will be unchanged). I can load the new firmware into the empty pages of the flash (ie. from 0x4C000). I set a 'nrf_dfu_settins_t' struct instance, write it back, then restart the device (see code snippet), but the new application did not load to the right place, so the original firmware will be starting. And magically, if I leave the J-Link SWD debugger on the panel, the new firmware will be started after a while (cca. 2-3 minutes).
What I missed, or made wrong way?
regards, Attila
__attribute__ ((aligned (32))) nrf_dfu_settings_t ds; const uint32_t SETTINGADDRESS = 0x7F000; const uint32_t UPDATE_FLASH_START = 0x4C000; memcpy((char*)&ds, (uint32_t*)SETTINGADDRESS, sizeof(ds)); // load original values ds.progress.update_start_address = UPDATE_FLASH_START; ds.bank_0.bank_code = 0; ds.bank_1.bank_code = 1; ds.bank_1.image_size = newApplicationFileSize; ds.bank_1.image_crc = crc32_compute((uint8_t*)ds.progress.update_start_address, newApplicationFileSize, 0); ds.boot_validation_app.type = 1; ds.boot_validation_crc = 0xFFFFFFFF; ds.crc = crc32_compute((uint8_t*)(&ds) + 4, (offsetof(nrf_dfu_settings_t, init_command)) - 4, 0); // write back this struct (to the MBR [0x7e000] area too) uint32_t err = sd_power_gpregret_clr(0, 0xffffffff); APP_ERROR_CHECK(err); err = sd_power_gpregret_set(0, BOOTLOADER_DFU_START); APP_ERROR_CHECK(err); nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);