We are using nrfutil 6.1.3 on Ubuntu 20.04LTS and nRF5 SDK 17.0.2
We're using a copy of the dfu/secure_bootloader as the bootloader. We've changed NRF_BL_DFU_INACTIVITY_TIMEOUT_MS to 0 and added our own keys.
On the device we already have a softdevice with id 0x100 and an application (with a different version number).
We build a dfu package with:
nrfutil pkg generate \
--softdevice sd.hex \
--application app.hex \
--key-file priv.pem \
--hw-version 52 \
--application-version 1654161769 \
--sd-req 0 \
--sd-id 0x100 \
pkg.dfu
(the softdevice is the same as is already on the device).
We put the device in DFU mode with:
sd_power_gpregret_clr(0, 0xffffffff);
sd_power_gpregret_set(0, 0xb1);
NVIC_SystemReset();
Then we try to update the device with:
nrfutil dfu usb-serial -pkg pkg.dfu -p /dev/serial/by-id/usb-Nordic_Semiconductor_*
nrfutil waits a while, then it starts to update the device, up to about 58%. After that we see that our old application has started again.
From this I'm guessing that the old softdevice version is updated to the same one once more, then it resets and starts the old application.
If I don't put the softdevice in the dfu package (and change to --sd-reg 0x100), then it works as expected, the application is updated and then starts.
What should we do differently to make it work with a sd+app dfu package?
I want the softdevice in the dfu package so it will work for devices with older softdevices on them as well.