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

IoT DFU on Contiki using CoAP Blocktransfer

[Aim] I am working on a project where I aimed to Integrate/Develop firmware management system using Contiki running over Nordic NRF52.

[Components] Contiki running over Nordic NRF52 + LwM2M (Management server) + CoAP block transfer (Transport Medium) + IoT DFU (Nordic's library to storing firmware into flash memory).

[Work Done] I can successfully run LwM2M and CoAP block transfer on Contiki running over Nordic NRF52 and struggling with Nordic's IoT DFU Contiki. I integrated the IoT DFU module (pstorage_raw) with Contiki application and trying to simply write and read into flash memory.

[Problem] For a start I wrote boot loader setting with sample firmware size .. crc ..etc (precisely the work done by "iot_dfu_firmware_apply()" in IoT DFU library). I did the initialization of nrf memory, pstorage and IoT DFU using their specified calls. The given logs shows that bootloader file was opened and written successfully but I never received the "IOT_DFU_WRITE_COMPLETE" callback from lower layer. Also if I am going to read the same setting again using "iot_file_fread()" it throws an error 45841.

[Debug Logs]

[IOT_DFU]: >> iot_dfu_init

[IOT_DFU]: << iot_dfu_init

[APPL]: Update Softdevice with Application.

[IOT_DFU]: >> iot_dfu_firmware_apply

[IOT_DFU]: Update SoftDevice upgrade status.

[IOT_DFU]: Update Application upgrade status.

[FILE][PSRaw] >> fopen.

[FILE][PSRaw]: FLASH file initialization.

[FILE][PSRaw] << fopen.

[FILE][PSRaw] >> fwrite.

[FILE][PSRaw]: ALLOC buffer.

[FILE][PSRaw] << fwrite.

[IOT_DFU]: << iot_dfu_firmware_apply

Note: It seems in contiki port for NRF52 there is a pstorage_platform.h file already given (platform/nrf52dk/config/pstorage_platform.h) however I am using the pstorage_platform.h given for IoT DFU application in Nordic IoT 9 SDK.

Any sort of support/suggestion would be appreciated. Also let me know if any other information is required.

  • Hi,

    I figured out the cause and writing it down.

    In NRF port of contiki there is no sys evt handler (in addition to the ble evt handler that is already registered) in cpu/nrf52832/ble/ble-core.c.

    Registering a sys evt handler and calling "pstorage_sys_event_handler(event)" from the handler would solve the purpose.

    PS: Seems like attachments is having some issue as I can't attach the patch with this post.

Related