Update firmware via SPI

According to the way our production and the way we update the firmware.

I will need a bootloader for nrf5340, so I can update the firmware via SPI.

What will be the best example code to use for this kind of project?

We can use JLINK the first time to download the bootloader.

Br, F Nielsen.

Parents
  • Hi Nielsen

    The nRF Connect SDK use MCUBoot as a bootloader.
    (Possibly together with the nRF Secure Immutable Bootloader(NSIB, previously called b0). But if you do not have specific need for NSIB, it is easier to just use MCUBoot.)

    MCUBoot use either Serial recovery or SMP to receive updates.
    For SMP, see the zephyr SMP SERVER sample.
    For Serial Recovery, I am testing if it will work for the nRF5340 now, and will update you on what I find tomorrow.

    Either way, the mcumgr is used for sending the new firmware to the nRF device. This supports the following transports:

    BLE (Bluetooth Low Energy)
    Serial (UART)
    UDP over IP

    In other words, unfortunately not SPI.

    I would recommend you to consider using UART or Bluetooth Low Energy instead of SPI.
    However, if you want to implement transport over SPI yourself, this could maybe be possible.
    But I do not know how much work it would be, as I have not done anything similar myself.

    In this case, maybe the following links could be helpful:
    SMP Protocol Specification

    File management

    https://github.com/zephyrproject-rtos/mcumgr

    Did this answer your questions?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd

    Thanks for your fast answer.

    You have answered my question.

    Our products have one main processor, all update of the product goes through this processor. The processors internally in the product use either SPI or I2C to communicate to the main processor. Have not decided yet what we will do about nrf5340, but thanks for your effort.

    Br, Frede.

  • Hi

    Sigurd Hellesvik said:
    For Serial Recovery, I am testing if it will work for the nRF5340 now, and will update you on what I find tomorrow.

    Since you got what you needed, I thought that I needed not hurry with this.

    But I figured it out today.

    Our Machine Learning Sample implements Serial Recovery for nRF5340, so you can use this with mcumgr to perform DFU over serial.
    Use the following commands to update both cores after resetting the device into Serial Recovery Mode(reset when holding button1):

    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512"image upload -n 3 build/zephyr/net_core_app_update.bin
    #wait min. 2 minutes to allow Network Core to copy image
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512" image uploadbuild/zephyr/app_update.bin
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512"image list
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512" reset

    So in case you need it later, and for reference for others, I will leave this explanation here.

    Regards,
    Sigurd Hellesvik

Reply
  • Hi

    Sigurd Hellesvik said:
    For Serial Recovery, I am testing if it will work for the nRF5340 now, and will update you on what I find tomorrow.

    Since you got what you needed, I thought that I needed not hurry with this.

    But I figured it out today.

    Our Machine Learning Sample implements Serial Recovery for nRF5340, so you can use this with mcumgr to perform DFU over serial.
    Use the following commands to update both cores after resetting the device into Serial Recovery Mode(reset when holding button1):

    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512"image upload -n 3 build/zephyr/net_core_app_update.bin
    #wait min. 2 minutes to allow Network Core to copy image
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512" image uploadbuild/zephyr/app_update.bin
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512"image list
    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM2,baud=115200,mtu=512" reset

    So in case you need it later, and for reference for others, I will leave this explanation here.

    Regards,
    Sigurd Hellesvik

Children
No Data
Related