Send dfu image between two nrf5340

Hi,

What is the best way to send image from one nrf5340 that is central to other nrf5340 that is peripheral in order to update him via 

MCUMGR
thanks
Parents
  • I added the echo command to my code.
    How to implement other commands?

    For example Reset or Upload the image?
    Where is an documentation for this(op,flags,id, payload types)?

    Thanks

  • Okay, so let me try to clarify:

    Hash5422

    If I understand it correctly, you want to perform a DFU update in the following manner: Cloud/server-->LTE-->9160 (NCS)-->UART-->52840 (nRF5 SDK).

    It may be a good idea to port the 52840 to NCS, especially if it's a new design. If you do port to NCS, then you could look at this pull request https://github.com/nrfconnect/sdk-nrf/pull/8839 (a customer updated the solution you've been looking to NCS v2.0.0). I think my (almost complete) solution should work fine as well (if 52840 runs NCS), you just need to modify it to get the binary chunks from the library that receives the binary from the cloud, instead of reading it from flash. If you're not planning to go for my solution, please continue the discussion in this thread: Perform NRF52840 OTA over the NRF9160 and UART, since it's nice to keep the thread clean and on-topic. I have worked some with this, so I could probably re-assign the ticket to me and give more inputs

    enpre

    Is this what you're trying to achieve? Cloud/server-->WiFi-->ESP32 (SDK?)-->UART-->52840 (SDK?)

    What SDK are you using on the ESP32? What SDK are you running on the 52840? If both are running NCS/Zephyr you could use my solution, and continue the discussion in this thread.

    If the esp32 is running some other SDK and the 52840 is running NCS, I think it is easier to just skip the SMP protocol (which the solution in this thread uses) and send the binary image as raw bytes. Check out this ticket for more information, it is the opposite of your solution but should still be relevant since it explains how to send the image as raw bytes and what to do on the 9160 once the update is received (the same should be done on the 52840 if NCS is used). However, if you have more questions regarding this, please continue the discussion in Perform NRF52840 OTA over the NRF9160 and UART. I have worked some with this, so I could probably re-assign the ticket to me and give more inputs

    If the esp32 is running some other SDK and the 52840 is running nRF5SDK, I will not be of much help, since I have not touched the nRF5 SDK in many years. Then you should probably continue the discussion in Perform NRF52840 OTA over the NRF9160 and UART, or if Håkon is not familiar with the nRF5 SDK either just create a new ticket. Remember to specify in the title that the 52840 is running the nRF5 SDK and the ticket will be assigned to an engineer with knowledge about this.

    Best regards,

    Simon

  • Hi,
    Thanks. 
    Did you test it on sdk 1.9.1? 

  • I tested it on NCS v2.0.0.

    Yesterday I was able to receive and parse the image list response, which is required to run in order to get the image hash. I have not implemented it yet, but now it should be straigth forward to test/confirm the image from the app. What is needed to do next is to run the image list command after doing the update, then store the hash of the newly updated image, confirm/test the new update using the stored hash and eventually reset it using the reset command.

    After doing this + cleaning up the sample, the solution is complete

    Feel free to create a pull request on https://github.com/simon-iversen/ncs_samples/tree/master/central_smp_client_dfu 

  • Hey Simon! Thanks for all your help. I was taking time to do some reading since I am not super familiar with smp and mcuboot as well. I am moving my 52840 code to NCS so both nrf9160 and nrf52840 are running NCS based code now. 

    So for the two solutions you proposed, I have follow up questions for you - 
    1. Using the ncs2.0.0 version of the solution I was trying: 

    - 
    I can copy the changes to the 14 files that this solution touches in ncs2.0.0. But from what I understand, this is a library implementation of DFU over UART. Seems like it is doing exactly what I am trying to achieve, but I am not sure how to effectively use it in an example or my own code. Is there an example that can help me test these changes or understand how I can use them in my project once I download the image from the server over LTE. 
    - NCS2.0.0 only supports VSCODE and I use SES as my compiler, can I use the same changes on ncs1.9.1 which continues to support ses ide. 

    2. Using the solution you provided in this thread: 

    - You mentioned that I could use this as well, if I manage to receive binary chunks from the cloud instead of reading it from the flash. However, your solution does the image transfer over BLE if I understand correctly. So I would have to find a way to send it over UART as well, correct? 

    - Could you provide a changelist of changed files so I can make sense of what you're doing in your implementation. 


    I apologize if I'm missing something obvious here, I am fairly new to this.

    I've broken down my task into these steps: 

    1. Generating the nrf52840 image with the right OTA header
    2. Uploading the image to our servers 
    3. Downloading the image over LTE on the nrf9160
    4. Dividing the image into header + fixed size chunks 
    5. Sending the data over UART
    6. Storing the image into FLASH Secondary storage 
    7. Copying the data over to the Primary Storage 
    8. Reboot and take new image 

    Correct me if I am wrong, my understanding is step 5 is implemented here and I could use your code for steps 6,7, 8.




    Could you assign the other thread to yourself so we can continue the discussion there? 

  • Hash5422 said:
    Could you assign the other thread to yourself so we can continue the discussion there? 

    I have assigned  Perform NRF52840 OTA over the NRF9160 and UART to myself, so let us continue the discussion there.

    Best regards,

    Simon 

Reply Children
No Data
Related