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 Reply Children
  • I've now put the app_update.bin file into flash of the device running the central_smp_client sample, then I read out the first 32 bytes containing the image header and sends it to the device running the smp_svr sample. The smp_svr side sends an image upload response in return, with "rc"=0 and "off"=32.

  • Amazing.
    if it is ok i can also test it on my side, i have an image stored at the external flash that i downloaded and i can read data and send it.
    You can attach a code for this.


  • Check it out here: https://github.com/simon-iversen/ncs_samples/tree/master/central_smp_client_dfu 

    The code is really messy and not cleaned up at all. Sorry about that. I'm using nRF52840 DK on both sides by the way, but I don't think that should matter.

    1. Program the central_smp_client_dfu to one nRF5340 DK and the smp_svr sample to another nRF55340 DK (I used 52840 DK)
    2. Put the app_update.bin file into flash address 0xf6000 using jlink commander and loadbin
    3. Then press button 2 on the device running central_smp_client_dfu sample, to send the image upload command.

    Then you should receive 0x300c0101bf6272630636f66661820ff in response.

    You can see these bytes by adding the following piece of code to C:\v2.0.0\nrf\subsys\bluetooth\services\dfu_smp.c--notify_process()

    printk("Received %d amount of bytes\n", length);
    printk("Bytes: 0x");
    for(int x = 0;x < length; x++){
    	printk("%x", ((uint8_t *)data)[x]);
    }
    printk("\n");

    Currently I'm struggling to parse the response in the app itself (using this method). But using cbor.me I'm able to see that the received data corresponds to this:

    300c0101bf   →     ???

    627263          →      "rc"

    0                    →       0

    636f6666             "off"

    1820                   32 (unsigned(32))

    ff                    →     end of packet I think

    So you can see that it contains rc=0 and off=32

    Let me know if you achieve any progress.

  • Now I'm able to parse the incoming image upload CBOR response in the central_smp_client sample. So to complete the image upload command, I just need to repeat the process and send all of image chunks.

  • Hi Guys, I need to integrate into my project an OTA update.
    I have a gateway (nrf52840) connected using UART to an external microcontroller to the cloud, and IoT nodes connected using BLE.

    I begin following one thread on devzone, and then the guys talk to me about your dev thread.
    I purpose to join together to make a def. guide as in Nordic Doc I always can't find the solutions to my problems Slight smile

    My idea was to get data from UART (as I connect the nordic to an ESP32 with AT commands for Wifi Connection) and then store them into flash, and after getting the file .hex from uart, restart the micro.

    Into the bootloader, pick up data from flash and store to the program memory zone, and after that, restart the micro and that's it.

    When the gateway is updated, the next step is to update also IoT node, but in this case, using the BLE and not the UART obviously.

    Using STM it's a child's play, using nordic everything seems to be impossible... is it the way you are proceding ?

Related