I have a product with an nRF9160 and using its modem to connect to a LWM2M server. I have recently enabled modem delta firmware updates, and have seen an annoying issue.
The first thing that is being done by the dfu_modem_delta code is to create a DFU socket and then erase the memory used for the delta update on the modem flash. This erase takes around 10-15 seconds in my case. After the erase is done, The data from the first block is used/written, then next block etc.
The lwm2m_rd_client/lwm2m_engine has a lifetime, used to re-register to the lwm2m server at an interval, to indicate that the client is still alive. What I noticed when doing modem delta update was that if I was unlucky and happened to want to re-register during the erase, the re-register fails, causing the client to lose connection to the server, and thus kind of aborting the modem update, since no more firmware blocks can be received until we have done a complete new registration, and then I have to actually re-initiate the download on the server side. And following downloads don't have to do the erase, but then I get errors from the modem, with type -5, basically indicating that the data is incorrect/corrupted (Maybe because the erase was interrupted? Or because we transfer wrong block of data?)
Is this a known problem? And what is the suggested way to avoid this?
I generally use a lifetime of 30 seconds, which gives around 50 % risk to get the error. I could force a re-register before doing the erase (to make sure I have ~30 seconds to do the erase), but that seems like only a temporary fix, and wouldn't work for shorter lifetimes.
Regards,
Andreas Pettersson