OFF CHIP OTA UPDATE using external flash

I am working on this project off chip ota update on nRF5_SDK  using ecample/thread/dfu

by now, i have done changes in these functions on_data_obj_create_request() and on_data_obj_write_request(). initially these functions were erasing and writing data in internal flash which I changed to qspi functions like nrf_drv_qspi_erase() and nrf_drv_qspi_write(). and it works perfectly.

Later i changed functions for hash verification which is also working but i am not sure about what should be the next step so that bootloader changes the earlier application with the new firmware image.

  • yes but inside the code  I am printing the firmware size from background_dfu_state.c and also from nrf_dfu_req_handler.c. and both these sizes are different. because of this difference there is this error  while creating object . if the size is large then the error is about firmware size overflow and if less then it is about object is not page aligned.

  • I see. I think the first step then is to check what the actual size of the image you are uploading is.

  • I have checked it multiple time. each time I upload the same firmware and size from the background_dfu_state.c remains same but size from nrf_dfu_req_handler.c keeps changing. and difference is near to 32 byte to 16 byte. if I am using earlier bootloader in which i haven't changed anything everything runs perfectly till downloading the firmware in external flash . 

    even once these sizes matched and then my code set this dfu bank also after dfu reset it seems like that bootloader is copying my app because the device turned green led on  which in my system happens only when i flash bootloader using jlink. but after that these sizes are not matching otherwise i think i have completed this task. i have also changed code inside bl_activate and image_copy to read from external flash and write in internal flash.

    my log stopped after this the green led on my system was on.

  • Priyesh Shahi said:
    I have checked it multiple time. each time I upload the same firmware and size from the background_dfu_state.c remains same but size from nrf_dfu_req_handler.c keeps changing. and difference is near to 32 byte to 16 byte. if I am using earlier bootloader in which i haven't changed anything everything runs perfectly till downloading the firmware in external flash . 

    I was wondering if these sizes matched the size of the *.bin file you uploaded.

    Priyesh Shahi said:
    even once these sizes matched and then my code set this dfu bank also after dfu reset it seems like that bootloader is copying my app because the device turned green led on  which in my system happens only when i flash bootloader using jlink

    You can read the memory to confirm if the binary is correctly stored in the external flash and that the same data is correctly copied to internal flash.

    e.g.

    // Read FLASH
    $ nrfjprog --memrd 0x0 --n 0x100000 > flash.txt
    
    // Read QSPI flash (note: nrfjprog is configured to use the standard QSPI pinout by default)
    $ nrfjprog -f nrf52 --memrd 0x12000000 > qspi_flash.txt

  • after this command nrfjprog -f nrf52 --memrd 0x100000 > qspi_flash.txt, inside the file  qspi_flash.txt

    and also the size of *bin file is different than both the sizes in dfu process. while trying to enable log for bootloader i tried to change in flash size in linker but it didn't work and I move on to next step. should i look in that also ?

      

Related