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

I want to insert a DFU module through BLE in my old ble project to upgrade my nrf5340 image

    i have look for many DFU examples in NCS1.5.0 , but samples are Abstract ,and can not to start . a ble test  app in phone have a menu that  can  send file to nrf5340 through ble ,  when ble of nrf5340 receive this file  ,file can as  a new image.

Parents
  • Simon thank you!!

     i place v1.5.1 directly in diak D ,all error like "can not find files"  disappear . I have tested your project . i first load D:\v1.5.1\nrf\samples\bluetooth\peripheral_uart\build\hci_rpmsg\zephyr\merged_CPUNET.hex in nrf5340 net core ,then load merged.hex in nrf5340 app core .run the program ,find that nrf5340 can use BLE  send uart data to app .but when app   send data to nrf5340 through ble ,nrf5340 reset.

  • Do the following:

    You should see the following log:

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0*** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 1.0.0
    Starting Nordic UART service example

    • Change Application version 1.0.0 to "Application version 2.0.0"
    • Run: 
      • west build -b nrf5340dk_nrf5340_cpuapp -d build_2
    • Don't flash the content in build_2
    • Transfer nrf/samples/bluetooth/peripheral_uart/build_2/zephyr/app_update.bin to the phone
    • Open the nRF Connect app on the mobile and connect to the "Nordic_UART_Service"
    • Click on DFU in the top right corner:

    • Select the file app_update.bin and click on "Test and confirm"
    • Then you should see the following log in the terminal (see that it was v1.0.0 first, then v2.0.0)

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 1.0.0
    Starting Nordic UART service example
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 2.0.0
    Starting Nordic UART service example

    • You can try to reset it again, pressing the reset button and you should see "Application version 2.0.0" all the time

    I did all this and it worked perfectly for me.

    Best regads,

    Simon

Reply
  • Do the following:

    You should see the following log:

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0*** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 1.0.0
    Starting Nordic UART service example

    • Change Application version 1.0.0 to "Application version 2.0.0"
    • Run: 
      • west build -b nrf5340dk_nrf5340_cpuapp -d build_2
    • Don't flash the content in build_2
    • Transfer nrf/samples/bluetooth/peripheral_uart/build_2/zephyr/app_update.bin to the phone
    • Open the nRF Connect app on the mobile and connect to the "Nordic_UART_Service"
    • Click on DFU in the top right corner:

    • Select the file app_update.bin and click on "Test and confirm"
    • Then you should see the following log in the terminal (see that it was v1.0.0 first, then v2.0.0)

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 1.0.0
    Starting Nordic UART service example
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    Application version 2.0.0
    Starting Nordic UART service example

    • You can try to reset it again, pressing the reset button and you should see "Application version 2.0.0" all the time

    I did all this and it worked perfectly for me.

    Best regads,

    Simon

Children
Related