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.

  • Simon:

    thanks for your answer!!!

        I can not download nRF Connect Device Manager app from google (i am in china ), not to mention nRF Connect Device Manager v4.24.2 . i have app nRF Coonect mobil and  nRF Toolbox , i have tried to use these two app   DFU with nrf5340dk ,but failed(these two app  all have DFU menu ) .  my mailbox is [email protected] .   can  you send nRF Connect Device Managerv4.24.2  app  to me using a mail?

  • I looked into this and found out that the apk files of the nRF Connect For mobile app should be available here: https://github.com/NordicSemiconductor/Android-nRF-Connect/releases. Use this one: https://github.com/NordicSemiconductor/Android-nRF-Connect/releases/tag/v4.24.3.

    Sorry for not providing you with this earlier.

  • Simon ,thank you .

    1.  I have followed your method step by step .and use the nRF Connect Mobile app v4.24.2  DFU app_update.bin in example  hello_world build folder.the debug information below : . the string:"Hello World! nrf5340dk_nrf5340_cpuapp " is exact example code 100 .but you can see the top shotcut image .when nrf5340dk board reset ,the program seem not to run the image app_update.bin of hello_word. 

     2. I use SEGGER embedded studio build my peripheral_uart project . the first build image in  folder \build\hci_rpmsg\zephyr  is  merged_CPUNET.hex(this image must first load in CPUNET core first, only load a time ) ,second  build image in folder \build\zephyr is merged.hex.  when Add CONFIG_BOOTLOADER_MCUBOOT= y to prj.conf of project peripheral_uart , build solution produces the third image app_update.bin and dfu_application.zip  in folder \build\zephyr,located same folder with second image . 

    3.first step load code of example smp_svr  as you advised in nrf5340dk , second step  using nRF Connect Device Manager app, commuicate with nrf5340dk through ble named Zephyr .  how can i deal with merged_CPUNET.hex,,ble thread  in my project peripheral_uart  conflict with ble in  smp_svr? 

    4. i have download image of  smp_svr and upgrade nrf5340dk image with app_update.bin of hello_word .  when i use jlink debug peripheral_uart ,always reset 

      the nrf5340dk cpu net core have load  merged_CPUNET.hex   of  peripheral_uart  a few days ago.

    4.below shotcut bmp is building  solutions   example smp_svr and  my project peripheral_uart  , produced two cpunet core 's image   , left is last part of example smp_svr's  merged_CPUNET.hex ,right is last part of my project peripheral_uart's  merged_CPUNET.hex  . there are different !!! ,  in this situation ,  if  using ble  to DFU,  can not use ble do other work.

  • Question 1:

    You need to confirm the image (hello world) in the primary slot to prevent it from rolling back. Use the approach described here: https://devzone.nordicsemi.com/f/nordic-q-a/68695/usb-dfu-with-nrf-connect-sdk/281680#281680 

    You can also confirm it over SMP BLE. However, the hello world sample doesn't support BLE, so you have to create the app_update.bin file from the smp_svr instead, then you can run the confirm image command ove BLE. Please tell me if you want me to explain this in more details.

    zhouhaifang said:
     2. I use SEGGER embedded studio build my peripheral_uart project . the first build image in  folder \build\hci_rpmsg\zephyr  is  merged_CPUNET.hex(this image must first load in CPUNET core first, only load a time ) ,second  build image in folder \build\zephyr is merged.hex.  when Add CONFIG_BOOTLOADER_MCUBOOT= y to prj.conf of project peripheral_uart , build solution produces the third image app_update.bin and dfu_application.zip  in folder \build\zephyr,located same folder with second image . 

    Your understanding is correct.

    zhouhaifang said:

    3.first step load code of example smp_svr  as you advised in nrf5340dk , second step  using nRF Connect Device Manager app, commuicate with nrf5340dk through ble named Zephyr .  how can i deal with merged_CPUNET.hex,,ble thread  in my project peripheral_uart  conflict with ble in  smp_svr? 

    4. i have download image of  smp_svr and upgrade nrf5340dk image with app_update.bin of hello_word .  when i use jlink debug peripheral_uart ,always reset 

    In order for the peripheral_uart example to work you need to program the network core with merged.cpunet.hex (BLE Controller) and the application core with zephyr.hex(containing the BLE host + the peripheral uart application (if mcuboot is used, use merged.hex instead, which contains build/zephyr/zephyr.hex + build/mcuboot/zephyr/zephyr.hex).

    If you perform dfu and put the hello world app into the primary slot, the ble host and peripheral uart will no longer be present and you will not be able to debug it more.

    There will be no conflicts between merged.cpunet.hex in the net core and what's in the app core (smp_svr or peripheral uart) since they are located on different cores.

    Please tell me if I have misunderstood you. Maybe you can tell me about your final goal, then I will be able to help you in a more constructive manner.

    zhouhaifang said:
    4.below shotcut bmp is building  solutions   example smp_svr and  my project peripheral_uart  , produced two cpunet core 's image   , left is last part of example smp_svr's  merged_CPUNET.hex ,right is last part of my project peripheral_uart's  merged_CPUNET.hex  . there

    I will look into this and get back to you.

  • Simon thank for your anser 

      1.  my project is derived from example peripheral_uart in NCS1.5.0  and final MCU used in  my project will be  nrf5340, so I use nrf5340dk and example peripheral_uart to start my project . 

     2. a ble receive event and a ble send thread are used to communicate with andriod pad or phone in my project ,  ble is basic and important function in my project .  i  nearly use  example peripheral_uart 's ble function and only a little change.

    3.my project is Gradually improved ,and old image will be repalced by a new better image . so i want to use andriod pad or phone app  DFU old image in nrf5340  THROUGH BLE .

    4.when insert DFU  function in my project ,,jlink also can be used to download and debug.  that is to say:  two ways can update old image , first way is by JLINK ,the other way is by DFU with a app through BLE.

    5. using ble DFU method like smp_svr maybe can DFU a project have no function of ble , if a project like peripheral_uart have ble function , DFU ble and project ble will conflict. last time i have showed you that  smp_svr's  net core image merged_CPUNET.hex is different  with peripheral_uart's net core image merged_CPUNET.hex. that is to say ,only one ble can work well. if you work periperal_uart 's ble , smp_svr's ble can not work .

    6. how to use a old-fashion method to upgrade  old image rather than method of smp_svr  :  ble module in peripheral_uart running in nrf5340   receive a file (new image as a file ) from app  , then nrf5340 write new image file in it's own flash area , then nrf5340 reset and load new image in flash area .

Related