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

Firmware update (DFU) from server or cloud.

Hello to all,

We are using nRF52840 with SDK v15.0 using SES, Our application is we have sensor devices with interface WiFi module. Sensor device will wake up as predefined time interval and send data to cloud using WiFi connectivity. 

Now we want to update this sensor devices firmware from server. Currently we are able to update firmware using secure_ble via android app. But our requirements and few questions as below:

  1. How I can download program zip file from server using WiFi and store it in flash memory? (We know how to store data array into flash using FDS but not understand how to store and read this zip file in nordic internal flash)
  2. What is best way to do as per following flow:

get zip file from sever --> store in flash --> switch application to DFU / boot-loader mode using button less --> read this file from flash --->send this file for upgrade firmware and replace with existing firmware.

For implement as per above will you please provide me sample example code and some tutorial for how to do that?

Looking forward your response..!!!

Thanks in Advanced..!!

Parents
  • Hi Vidar,

    Thanks for providing this very useful thread link. I have read this thread and also download source code as attached there.

    But I am not understand How i can start to implement this?  For your information the below our current existing working application in brief:

    We have used external WiFi module and interfaced with nRF52840 via UART. This WiFi module is communicate with nordic controller via AT command for sending our data to server as predefined interval set.  

    Now my question is How i can download or get program zip file from server with chunks via uart_event_handler in nRF52840 buffer. For that can you provide me sample program snippet to know better understanding.

    Thanks for supporting....!!!!

  • Hi Vidar,

    I have stored binary raw data of program zip into nRF52840 internal flash memory. Switch device into DFU mode and in DFU main.c file I have added fds.c and fds.h libraries to read this stored file from internal flash memory.

    Now I read this program zip from flash using specific file_ID and address in DFU mode. To implement next I am little bit confused and some questions:

    1. Where should i need to send this zip file buffer in dfu_request_handler?
    2. Which function need to pass this zip file buffer from main.c(secure_bootloader_uart_debug)?

    I required to update firmware without DFU controller, hence our device is act as DFU target as well as DFU controller.

    Looking forward your response..!!!

    Thanks..

  • Looking forward your response....!!

    Thanks..!!!!!

  • Hi,

    I suggest that you start with the example I made and see how the UART RX events are forwarded from nrf_dfu_serial_uart to nrf_df_serial and dfu_request handler. It should be enough to replace nrf_dfu_serial_uart.c & nrf_dfu_serial.c with your own "Wifi" transport.

    vishal said:
    Switch device into DFU mode and in DFU main.c file I have added fds.c and fds.h libraries to read this stored file from internal flash memory.

     Is this in the app or in the bootloader? The DFU should be handled by the app when you do background DFU. 

    vishal said:
    Where should i need to send this zip file buffer in dfu_request_handler

    You need to include create object, execute, etc commands in the requests. Please refer to the message sequence charts for serial DFU. 

  • Hi Vidhar,

    Thanks for your response, 

    Actually I downloaded your example that you have made for nRF52840 with name is "nRF_SDK_15.3.0_background_dfu_3.zip". This example is complied properly but when i tried to upload this into my nRF52840 board using SeS got EROOR like unknown function at 0xFFFFFFFE

    How i can fixed this error at our side?

    We want use to handle DFU in our running application How i can merge this background DFU libraries with our existing application.

    Is this any example for that How use background DFU ? As available lib description here 

    Thanks for great support..!!

  • Hi,

    It looks like you haven't programmed the Softdevice. Please make sure to follow the steps outlined in the readme. 

    vishal said:

    We want use to handle DFU in our running application How i can merge this background DFU libraries with our existing application.

    Is this any example for that How use background DFU ? As available lib description here 

    The IOT example can be used as a reference. You can also see what files I added to my example which was based on the ble_app_hrs example. 

Reply
  • Hi,

    It looks like you haven't programmed the Softdevice. Please make sure to follow the steps outlined in the readme. 

    vishal said:

    We want use to handle DFU in our running application How i can merge this background DFU libraries with our existing application.

    Is this any example for that How use background DFU ? As available lib description here 

    The IOT example can be used as a reference. You can also see what files I added to my example which was based on the ble_app_hrs example. 

Children
  • Hi,

    After programmed SD on SES IDE got another error which is 

    I am little bit confused in your readme fie under testing point 3) Start a debug session in SES to view the debug log?

    Is i need to programmed bootloader before softdevice program?

    I am able to compile our application code with your background dfu example files but got same error bootloader address is not set. If i comment it then got an issue with nrf_dfu_inti() function which is ERROR 8 NRF_ERROR_INVALID_STATE.

    I have refered  IoT example background dfu over TFTP but it looks like complex and different.

    I know how to communicate with server and get exacted zip in our application. But problem getting for implementing background DFU to handle their request in app.

    Thanks....

  • Hi Vidhar,

    I am facing lots of difficulties to implement background DFU and our WiFi based custom transport layer.

    I have read and understand IoT based background DFu over TFTP and COAP but it looks like different.

    Will you please guide me or provide sample example for WiFi based transport layer?

    I am stuck for implementing custom WiFi based transport layer for background DFU, If you provide me complete NRF logs of working project. I can try with that flow to implement next part with my best.

    Thanks.. looking forward your response..

  • Hi,

    That's unfortunate, but I'm afraid I can't help you with exact instructions for creating a Wifi transport.  

    vishal said:
    I am stuck for implementing custom WiFi based transport layer for background DFU, If you provide me complete NRF logs of working project. I can try with that flow to implement next part with my best.

    I provided a working project with UART transport. Did you manage to get it working on your side? 

  • Hi,

    Not working at my side getting ERROR Bootloader address is not set for more details about this error will you please check my last reply in above.

    I follow below steps as given in your readme doc file:

    1. Open ble_app_hrs_w_serial_project in SES compile and program my nRF52840 DK board.
    2. run program_bl_sd_bl_settings.sh observe one LED continuous ON and second one is blinking.

    Can you please explain the steps of test your example so i can understand How background DFU work.

    Thanks..

  • I didn't update the Readme after adding support for 52840. You need to run program_bl_sd_bl_settings_52840.bat

Related