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.

  • Follow the steps in this answer: https://devzone.nordicsemi.com/f/nordic-q-a/69368/nrf5340-fota-system-reset-after-pairing/286031#286031

    I assume you have the nRF5340 DK and not the nRF5340 PDK. In that case use nrf5340dk_nrf5340_cpuapp instead of nrf5340pdk_nrf5340_cpuapp.

    Best regards,

    Simon

  • Simon ,thank you .

         the way you have tested of DFU maybe only load the image of \ncs\v1.4.0\zephyr\samples\subsys\mgmt\mcumgr\smp_sv to the nrf5340dk board . when you want to run  your own project ,you must first download  the  smp_sv  image to nrf5340dk board  ,later palce your own project image in a phone using this method to  loaddown to nrf5340dk board  .

        but a project   always need to revise . improve ,debug , when debugging ,i should directly download new image to nrf5340dk using debug tool , rather than  place new image in a phone .to use the method you have told to load in nrf5340dk board. 

       how  to creat a project  that   not only can update image using a phone app through bluetooth as you have told , but also can update image through debug tools like PCA10095 ?

  • zhouhaifang said:
       how  to creat a project  that   not only can update image using a phone app through bluetooth as you have told , but also can update image through debug tools like PCA10095 ?

    If you're struggling with programming the chip, you may have to recover it first, check out Readback protection for instructions how to do it.

    If you are programming a BLE application, you need to program the network core manually first, check out 2.2 nRF5340 DK-->2.2.1 Build a BLE example for instructions how to do this

    You can flash the image using the debugger/programmer in many different ways:

    • Segger Embedded Studio: Simply click 'Build and run'

    • West
      • cd <name of build folder>
      • west flash
        • If you're programming a ble application, the network core will automatically get programmed with the appropriate firmware
    • nrfjprog:
      • cd <name of build folder>/zephyr
      • Single image build: nrfjprog --program zephyr.hex --sectorerase 
      • Multi image build: nrfjprog --program merged.hex --sectorerase 

    Best regards,

    Simon

  • Simon ,thank you .
      I have already knew how to flash nrf5340dk ,but how to DFU nrf5340dk is not know .i can not build  the example in v1.5.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr  using BLe to upgrade image must enable CONFIG_MCUMGR_SMP_BT and include bluetooth.c in src folder ,but bulid  ,these are many errors. .when i input these path with exact path as #include<D:\work\v1.5.0\zephyr\include\bluetooth/bluetooth.h> , the bluetooth.h 's include header file cannot find
  • zhouhaifang said:
    Simon ,thank you .
      I have already knew how to flash nrf5340dk ,but how to DFU nrf5340dk is not know .i can not build  the example in v1.5.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr  using BLe to upgrade image must enable CONFIG_MCUMGR_SMP_BT and include bluetooth.c in src folder ,but bulid  ,these are many errors.

    You don't need to include bluetooth.h or enable CONFIG_MCUMGR_SMP_BT explicitly. Just add the line '- -DOVERLAY_CONFIG=overlay-bt.conf' when building with west, which should include the file overlay-bt.conf and set CONFIG_MCUMGR_SMP_BT.

    Please follow these steps: https://devzone.nordicsemi.com/f/nordic-q-a/69368/nrf5340-fota-system-reset-after-pairing/286031#286031 

    • cd into C:\Users\<user name>\ncs\v1.5.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr
    • Connect the nRF5340 DK to the computer and turn it on
    • Run west build -b nrf5340dk_nrf5340_cpuapp -p -- -DOVERLAY_CONFIG=overlay-bt.conf && cd build && west flash
    • Add CONFIG_BOOTLOADER_MCUBOOT=y to <..>/zephyr/samples/hello_world/prj.conf
    • cd into zephyr/samples/hello_world
    • Run west build -b nrf5340dk_nrf5340_cpuapp -p
    • Transfer <..>/zephyr/samples/hello_world/build/zephyr/app_update.bin to the phone
    • Install and open the nRF Connect Device Manager app on the phone, then connect to the nRF5340 which should be advertising with the name "Zephyr"
    • Perform a Firmware Upgrade using the app_update.bin file

    Best regards,

    Simon

Related