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

Need FOTA Support in LWM2M firmware update object using block2 coap process.

Hi 

We searched a lot of stuff regarding FOTA update in nRF52840DK using Lwm2m and coap protocol. But we could not get help in the right direction. We could not find any stuff or documentation (explanation) regarding BACKROUND_DFU in nRF16_SDK.

We already implemented firmware object and its instance callback with existing lwm2m client example. Now we want to update the firmware over the air using lwm2m and coap protocols. Please share any kind of stuff or example you have so that we can get out from this trouble

  • Hi

    We tried to inspect the iot bootloader by running iot bootloader code in build and debug mode using segger studio. 
    We found that when device is reset by the application after getting NRF_DFU_EVT_DFU_COMPLETED in DFU_observer present in coap_dfu.c file.

    The bootloader code call the function nrf_bootloader_init(dfu_observer)  and inside this function
    i)call the nrf_dfu_settings_init () 
    ii)call  the postvalidate()  
    iii)call the nrf_bootloader_fw_activate()
    This function results ACTIVATION_NONE in returns.But when we read thge menory from nRF_connect application there is application present in bank1 you can see this in previous image in our last messages.

    you can see this functionality in nrf_bootloader.c file. 

    We confirmed that after application restart using  NVIC_SystemReset(). Bootloader start and run every time.

    One more thing is noticed in the log when the init command packet is received from the server we got the error Invalid init command  but we already used the nrfutil command to generate the package

    "nrfutil pkg generate --hw-version 52 --sd-req 0xca --application-version 2 --application pca10056\s140\ses\Output\Debug\Exe\version_12_2.hex --key-file "E:\till\fota\examples\iot\project_iot\lwm2m_client\pca10056\s140\ses\Test.pem" app_dfu_Test_package.zip"


    Is this a right way to generate the package. If no please guide me.

    Br

    Pankaj Jaswal

  • Hi Pankaj,

    I must admit that we do not have much experience with the experimental IoT DFU, as it is not much used, so unfortunately that makes it a bit more difficult than usual to make good suggestions. But hopefully we will get there in the end.

    Regarding nrf_bootloader_fw_activate() returning ACTIVATION_NONE that shows that the bootloader does not know that there is an image to activate because the bank_code for bank 1 does not indicate that a valid app is present. So this was not correctly configured before the reste (into the bootloader).

    The Invalid init command error would be because the init command which is stored in the dfu_settings page is invalid. Was it copied there correctly in the first place? The nrfutil comand seems sensible, so the init command within the DFU zip should be correct.

  • Hi Einar

    Thank you so much for your continuous support. 

    We successfully debug the bootloader and find the exact problem.

    It was related to the public and private key. During Post validation function public key tried to decode the signature of the packet but due to the wrong public and private key it was generating an error for me.

    Br

    Pankaj Jaswal

Related