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

nRF91 firmware upgrade over BLE

Hi,

I am trying to do firmware upgrade of nRF91 over BLE using nRF52 on the nRF91-DK or Thingy91 board. They both have nRF91 and nRF52840 chips on them which are connected. 

As I understand from the documentation, at the moment, on Thingy91 board I can connect to the USB (which is connected to the nRF52) and upgrade the firmware on nRF91. This is also providing two UART ports, and the BLE UART service can be additionally enabled. Like in example: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/connectivity_bridge/README.html

On the nRF91 side, nRF91 application would have to implement the UART management transport so it can be upgraded over UART and the nRF5x act as a bridge from BLE to UART
https://docs.zephyrproject.org/1.13.0/subsystems/mgmt.html

Is this a good way to go and do you have some experience doing this?

At the moment I have a bit different approach. I started with nRF52 app_ble_uart example and created the "UART bridge" between BLE device and nRF91. Next is to have nRF91 able to receive upgrade and probably write some application for PC/mobile deice to push the upgrade over UART. 

Let me know your thoughts and if you already have done something like this. 

Best regards,
Vojislav.

  • Hi Simon,

    I am back on this subject, and I have read everything you referenced in previous responses. Now I have a bit better understanding of Zephyr, MCUboot, and its modules. 

    So let's start from the nRF91 side. The first thing is to get the nRF91 into the serial recovery mode. On the Thingy91 this is done bu holding SW3 and rebooting the device, and I would like to do that as well on nRF91-DK. So I created file /ncs/bootloader/mcuboot/boot/zephyr/boards/nrf9160_pca10090.conf as you suggested. When I build an asset_tracker application with mcuboot enabled and hold Button1 on the nRF91-DK the board does not boot, so I assume that it is stuck somewhere in the bootloader. My next step was to try to flash new applications using nRF-Connect for Desktop and MCUBoot option, but this does not work, it never starts. 

    Is there something else I need to be able to write an app image over UART? 
    Where is defined which UART pins MCUboot will use for SMP?

    Currently, I have setup with NCS v1.2.0 and Ubuntu 18.04LTS

    I am not sure if this functionality was added in this release:
    https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/thingy91_2d00_fw_2d00_update_2d00_mcuboot

    Best regards,
    Vojislav. 

  • My apologies for the delay. I will look prioritize your issue in the next days.

    Best regards,

    Simon

  • Ok, Simon, I am also looking into it. I forgot to write that nrf9160_pca10090.conf file for MCUBoot looks like this:

    # Disable Zephyr console
    CONFIG_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=n
    CONFIG_UART_CONSOLE=n
    
    # MCUBoot settings
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    
    # MCUboot serial recovery
    CONFIG_MCUBOOT_SERIAL=y
    CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0"
    CONFIG_BOOT_SERIAL_DETECT_PIN=6
    CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0


    To configure Button 1 on the nRF91-DK as the trigger for serial recovery mode.

  • Hi Simon,

    I have managed to upload the new app image over UART to the nRF91-DK using mcumgr and configuration I explained in the previous post.
    The command for upload is:

    $ mcumgr --conntype=serial --connstring=/dev/ttyACM0 image upload app_update.bin 
     223.01 KiB / 223.01 KiB [==================================================] 100.00% 3.34 KiB/s 1m6s
    Done
    


    My question still stands, 
    Where is defined which UART pins MCUboot will use for SMP?
    Does it take from nrf91 board device tree file? and will overlay file in the application folder affect the change of pins/port?

    Best regards,
    Vojislav.

  • Vojislav said:
    Where is defined which UART pins MCUboot will use for SMP?
    Does it take from nrf91 board device tree file? and will overlay file in the application folder affect the change of pins/port?

    If you look at the line uart_dev = device_get_binding(CONFIG_RECOVERY_UART_DEV_NAME) in serial_adapter.c, you can see that it will use the UART instance CONFIG_RECOVERY_UART_DEV_NAME.

    CONFIG_RECOVERY_UART_DEV_NAME is by default equal to "UART_0".

    If you build the sample in ncs\bootloader\mcuboot\boot\zephyr using e.g. nrf9160_pca10090, and you haven't added an nrf9160_pca10090.overlay file inside ncs\bootloader\mcuboot\boot\zephyr, then the default pin configurations in zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090_common.dts will be used in MCUboot for the transmission of the mcumgr SMP data.

    Since UART_0 is routed to the USB port through the interface MCU, you can use the computer to perform a DFU

    However, you can change the UART instance as well as the UART configurations, by setting CONFIG_RECOVERY_UART_DEV_NAME to something else in prj.conf and creating an overlay file in ncs\bootloader\mcuboot\boot\zephyr.

    Best regards,

    Simon

Related