Perform NRF52840 OTA over the NRF9160 and UART

Hello, 

I am developing a BLE - LTE sensor gateway using the NRF9160DK.

I have written code for OTA updating the 9160 chip over LTE, but I am not sure how to update the NRF52840 side. Both those chips are connected via UART so I am guessing performing an OTA over UART for BLE would be the best approach but I am not sure how to go about it. 

Are there sw examples for these? I read a few related tickets on DevZone but they weren't super clear, could you provide the right documentation to get me started as well? 

Parents
  • Hello Hash5422, I will try to go through your questions from Send dfu image between two nrf5340.

    Hash5422 said:
    - 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. 

    When initially creating the solution (for NCS v1.2.0), I created some instructions how to run the solution and perform DFU in the following manner Cloud/server --> LTE --> nRF9160 --> UART --> nRF5x.

    • Check out NCS (nrf) v1.2.0 and run west update
    • Place patch.diff into  <ncs installation dir>/nrf
    • Open a command line in <ncs installation dir>/nrf and run git apply patch.diff
    • Connect an nRF9160 DK to your computer, turn it on and set SW5 to nRF52
    • Open up several serial terminals to see the logging from respectively the 9160 and the 52840
    • cd into <..>\nrf\samples\other\test_lte_uart_dfu_lib and run
      • west build -b nrf52840_pca10090 && west flash
    • Set SW5 to nRF91
    • cd into <..>\nrf\samples\nrf9160\http_application_update and run
      • west build -b nrf9160_pca10090ns && west flash
    • Wait till you see the following log from the 9160: "Press Button 1 to start the FOTA download", then press Button 1 on the 91 DK
    • When you see the log "UART DFU transmission complete" in the log from the 9160 and the logging from the 52840 stops up (I forgot to enable log on the 52840 side signifying that the DFU was finished) do the following:
      • Set SW5 to nRF52
      • Press the RESET Button on the 91 DK
    • If everything works as expected, you will see the following log:

     *** Booting Zephyr OS build v2.1.99-ncs1 **
    [00:00:00.120,208] [1B][0m<inf> mcuboot: Starting bootloader[1B][0m
    [00:00:00.126,312] [1B][0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[1B][0m
    [00:00:00.136,108] [1B][0m<inf> mcuboot: Boot source: none[1B][0m[00:00:00.141,479] [1B][0m<inf> mcuboot: Swap type: test[1B][0m
    [00:00:02.377,655] [1B][0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[1B][0m
    [00:00:02.385,162] [1B][0m<inf> mcuboot: Jumping to the first image slot[1B][0m
    ** Booting Zephyr OS build v2.1.99-ncs1 ***Hello world! nrf52840_pca10090

    You should be able to use the same instructions for the 1.4.0 version of the solution.

    However, I'm not sure how many changes Giuliano has made to the solution in https://github.com/nrfconnect/sdk-nrf/pull/8839, and if my instructions are still valid. I suggest that you study his NCS v2.0.0 patch (raw patch), and compare it with my NCS v1.4.0 patch (raw patch), and check if there are any relevant differences.

    Hash5422 said:
    - 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

    I don't think it should be too much work downgrading Giuliano's solution from NCS v2.0.0 to NCS v1.9.0. Just try to apply the patch to NCS v1.9.0 and see if it works. If it doesn't let me know and I'll take a look at it.

    If you want to migrate the NCS v1.4.0 to NCS v1.9.0, I would recommend you to do it one step a the time (first v1.4.0 to v1.5.0, then to v1.6.0, and so on..). Let me know if you face any difficuilties with this.

    By the way, I would recommend you to migrate to VS Code soon or later. The migration should be fairly simple: https://nrfconnect.github.io/vscode-nrf-connect/connect/migrating_ide.html 

    Hash5422 said:
    - 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?

    I forgot about this when I pointed to this solution. In order to use this solution you need to swap out the transfer medium from Bluetooth to UART. I think it will require less work to either just upgrade my DFU NCS v1.4.0 solution to NCS v1.9.0, or downgrade Giulianos solution from NCS v2.0.0 to NCS v1.9.0.

    So maybe we should wait with this approach, and focus on the other approach (DFU UART LTE v2.0.0 and DFU UART LTE v1.4.0).

    Please, don't hesitate if anything is unclear, or if you encounter any issues doing the migration.

    Best regards,

    Simon

Reply
  • Hello Hash5422, I will try to go through your questions from Send dfu image between two nrf5340.

    Hash5422 said:
    - 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. 

    When initially creating the solution (for NCS v1.2.0), I created some instructions how to run the solution and perform DFU in the following manner Cloud/server --> LTE --> nRF9160 --> UART --> nRF5x.

    • Check out NCS (nrf) v1.2.0 and run west update
    • Place patch.diff into  <ncs installation dir>/nrf
    • Open a command line in <ncs installation dir>/nrf and run git apply patch.diff
    • Connect an nRF9160 DK to your computer, turn it on and set SW5 to nRF52
    • Open up several serial terminals to see the logging from respectively the 9160 and the 52840
    • cd into <..>\nrf\samples\other\test_lte_uart_dfu_lib and run
      • west build -b nrf52840_pca10090 && west flash
    • Set SW5 to nRF91
    • cd into <..>\nrf\samples\nrf9160\http_application_update and run
      • west build -b nrf9160_pca10090ns && west flash
    • Wait till you see the following log from the 9160: "Press Button 1 to start the FOTA download", then press Button 1 on the 91 DK
    • When you see the log "UART DFU transmission complete" in the log from the 9160 and the logging from the 52840 stops up (I forgot to enable log on the 52840 side signifying that the DFU was finished) do the following:
      • Set SW5 to nRF52
      • Press the RESET Button on the 91 DK
    • If everything works as expected, you will see the following log:

     *** Booting Zephyr OS build v2.1.99-ncs1 **
    [00:00:00.120,208] [1B][0m<inf> mcuboot: Starting bootloader[1B][0m
    [00:00:00.126,312] [1B][0m<inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3[1B][0m
    [00:00:00.136,108] [1B][0m<inf> mcuboot: Boot source: none[1B][0m[00:00:00.141,479] [1B][0m<inf> mcuboot: Swap type: test[1B][0m
    [00:00:02.377,655] [1B][0m<inf> mcuboot: Bootloader chainload address offset: 0xc000[1B][0m
    [00:00:02.385,162] [1B][0m<inf> mcuboot: Jumping to the first image slot[1B][0m
    ** Booting Zephyr OS build v2.1.99-ncs1 ***Hello world! nrf52840_pca10090

    You should be able to use the same instructions for the 1.4.0 version of the solution.

    However, I'm not sure how many changes Giuliano has made to the solution in https://github.com/nrfconnect/sdk-nrf/pull/8839, and if my instructions are still valid. I suggest that you study his NCS v2.0.0 patch (raw patch), and compare it with my NCS v1.4.0 patch (raw patch), and check if there are any relevant differences.

    Hash5422 said:
    - 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

    I don't think it should be too much work downgrading Giuliano's solution from NCS v2.0.0 to NCS v1.9.0. Just try to apply the patch to NCS v1.9.0 and see if it works. If it doesn't let me know and I'll take a look at it.

    If you want to migrate the NCS v1.4.0 to NCS v1.9.0, I would recommend you to do it one step a the time (first v1.4.0 to v1.5.0, then to v1.6.0, and so on..). Let me know if you face any difficuilties with this.

    By the way, I would recommend you to migrate to VS Code soon or later. The migration should be fairly simple: https://nrfconnect.github.io/vscode-nrf-connect/connect/migrating_ide.html 

    Hash5422 said:
    - 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?

    I forgot about this when I pointed to this solution. In order to use this solution you need to swap out the transfer medium from Bluetooth to UART. I think it will require less work to either just upgrade my DFU NCS v1.4.0 solution to NCS v1.9.0, or downgrade Giulianos solution from NCS v2.0.0 to NCS v1.9.0.

    So maybe we should wait with this approach, and focus on the other approach (DFU UART LTE v2.0.0 and DFU UART LTE v1.4.0).

    Please, don't hesitate if anything is unclear, or if you encounter any issues doing the migration.

    Best regards,

    Simon

Children
No Data
Related