Hello.
I'm using nrf9151 with nRF Connect SDK v3.1.1 and Zephyr v4.1.99, modem firmware v2.0.2
I try to implement the full modem update. After downloading the "firmware.update.image_2.0.1.cbor" file from Thingsboard server via CoAP, I'm writing it to external flash. I also check the hash value by reading back from extern flash and it is correct. After that I disconnect from LTE network and try to call nrf_modem_lib_shutdown(), nrf_modem_lib_bootloader_init() and fmfu_fdev_load().
int err;
LOG_INF("Disconnecting from LTE network");
err = lte_lc_offline();
if (err)
{
LOG_ERR("Failed to disconnect from LTE network, error: %d", err);
return err;
}
k_msleep(10000);
err = nrf_modem_lib_shutdown();
if (err != 0)
{
LOG_ERR("Modem shutdown failed: %d.", err);
return err;
}
k_msleep(10000);
err = nrf_modem_lib_bootloader_init();
if (err != 0)
{
LOG_ERR("nrf_modem_lib_bootloader_init() failed: %d.", err);
return err;
}
k_msleep(10000);
err = fmfu_fdev_load(fmfu_buf, buf_len, flash_dev, 0);
if (err != 0)
{
LOG_ERR("fmfu_fdev_load failed: %d.", err);
nrf_modem_lib_shutdown();
return err;
}
err = nrf_modem_lib_shutdown();
if (err != 0)
{
LOG_ERR("nrf_modem_lib_shutdown() failed: %d.", err);
return err;
}
The problem is, that sometimes the call to nrf_modem_lib_bootloader_init() fails with error -116. Sometimes it works but then fmfu_fdev_load() fails with error (-22 - Unable to decode wrapper).
What I'm doing wrong?
Thanks and BR
Christian