[OTA] Cannot upload different FW through DFU_OTA process

Hi, I have a problem related to DFU OTA through BLE

When performing OTA through Bluetooth, I encountered the following issue:

Firmware built in the same build can be successfully updated via OTA using the nRF Connect App on an iPhone (limited to firmware from the same build). However, if firmware from a different build is used, the following error message appears on UART:

 `<err> mcumgr_img_grp: Failed to open flash area ID 2: -2`

` <err> mcumgr_img_grp: Image upload inspect failed: 5`

How can I update the firmware in different built through BLE with the edge device using OTA ?

I am using nrf5340 + ncs2.4.2

  • Hello,

    Could you share the whole log here? Please use the insert tab to paste the whole log.

    Firmware built in the same build can be successfully updated via OTA using the nRF Connect App on an iPhone (limited to firmware from the same build). However, if firmware from a different build is used, the following error message appears on UART:

    Please explain what you mean by different builds here. Do you mean different configurations for the same application, or are you trying to build the same application on different hardware? Sorry, I didn't understand this very well.

    By seeing the snippet of the log you shared, it looks like the application is failing to open the mcuboot_secondary slot. Are you using an external flash here? I also recommend checking the partition manager file to see that you have properly configured the mcuboot_primary and secondary slots.

     

    Kind Regards,

    Abhijith 

  • Hi Abhijith,

    This is the whole log below

    `

    [00:01:57.130,218] <inf> main: Connected 4F:E8:0F:48:6B:E6 (random)
    CONNECTED
    [00:01:57.130,249] <inf> main: Connection parameters update requested
    [00:01:57.131,042] <inf> main: bt_conn_le_phy_update successful
    [00:01:57.439,575] <inf> main: LE data len updated: TX (len: 251 time: 2120) RX (len: 251 time: 2120)

    [00:01:57.558,441] <inf> main: LE PHY updated: TX PHY LE 2M, RX PHY LE 2M

    [00:01:57.648,803] <inf> main: ATT MTU size updated to 247 bytes
    [00:01:57.678,680] <wrn> bt_l2cap: Ignoring data for unknown channel ID 0x003a
    [00:01:57.799,102] <inf> main: Conn params updated: interval 30 ms, latency 0, timeout: 4000 ms
    [00:02:09.919,250] <inf> mcuboot_util: Swap type: perm
    [00:02:09.919,433] <err> mcumgr_img_grp: Failed to open flash area ID 2: -2
    [00:02:09.920,166] <inf> mcuboot_util: Swap type: test
    [00:02:10.008,789] <inf> main: Conn params updated: interval 30 ms, latency 0, timeout: 420 ms
    [00:02:10.185,974] <inf> mcuboot_util: Swap type: perm
    [00:02:10.185,974] <err> mcumgr_img_grp: Image upload inspect failed: 5

    `

    The different build means same configuration with same prj.conf and nrf5340dk_nrf5340_cpuapp.overlay, hardware and application, but only different build time. For example: build_1 and build_2.

    I have these three files in my child_image folder for mcuboot.

    ## hci_rpmsg.conf
    
    #CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    #CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=502
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    CONFIG_BT_BUF_ACL_TX_COUNT=18
    
    CONFIG_BT_MAX_CONN=2
    
    CONFIG_BT_CONN_TX_MAX=50
    CONFIG_BT_L2CAP_TX_BUF_COUNT=50
    #CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_L2CAP_TX_MTU=247

    ## mcuboot.conf
    
    # Enable QSPI drivers for external flash
    CONFIG_NORDIC_QSPI_NOR=y
    # Increase the slot sizes from too large
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    
    # Logging
    CONFIG_LOG=y
    CONFIG_MCUBOOT_LOG_LEVEL_WRN=y
    
    # Enable simultaenous multi-core updates
    CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    CONFIG_BOOT_UPGRADE_ONLY=y
    CONFIG_PCD_APP=y
    
    # Dependencies for CONFIG_NRF53_MULTI_IMAGE_UPDATE
    CONFIG_FLASH=y
    CONFIG_FLASH_SIMULATOR=y
    CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
    CONFIG_FLASH_SIMULATOR_STATS=n

    ## mcuboot.overlay
    
    / {
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
    };
    

    This is my prj.conf and pm_static.yml:

    ## prj.conf
    
    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    # General config
    CONFIG_ASSERT=y
    
    # Make sure printk is printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="LaminarP1_OTA"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    CONFIG_BT_CONN_TX_MAX=30
    CONFIG_BT_L2CAP_TX_BUF_COUNT=30
    CONFIG_BT_L2CAP_TX_MTU=247
    #CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_BUF_ACL_TX_COUNT=18
    #CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=502
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=300
    CONFIG_BT_USER_PHY_UPDATE=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_GATT_DM=y
    CONFIG_BT_DATA_LEN_UPDATE=y
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
    CONFIG_SYSTEM_WORKQUEUE_PRIORITY=-10
    
    # Logging
    CONFIG_SERIAL=y
    CONFIG_LOG=y
    CONFIG_LOG_PRINTK=y
    CONFIG_USE_SEGGER_RTT=y
    
    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=91000
    CONFIG_BT_RX_STACK_SIZE=15384
    CONFIG_HEAP_MEM_POOL_SIZE=4096
    CONFIG_SHELL_STACK_SIZE=8192
    CONFIG_SHELL_THREAD_PRIORITY_OVERRIDE=y
    CONFIG_SHELL_PRINTF_BUFF_SIZE=4096
    
    
    
    # I2C
    CONFIG_I2C=y
    CONFIG_NRFX_TWIM1=y
    
    # I2S
    CONFIG_I2S=y
    CONFIG_I2S_NRFX_TX_BLOCK_COUNT=300
    
    #SPIM
    CONFIG_SPI=y
    CONFIG_SPI_SLAVE=n
    CONFIG_SPI_ASYNC=y
    CONFIG_NRFX_SPIM3=y
    CONFIG_NRFX_SPIM4=y
    CONFIG_POLL=y
    
    # Rebooot
    CONFIG_REBOOT=n
    CONFIG_RESET_ON_FATAL_ERROR=n
    
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    
    # file system
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_SHELL=y
    CONFIG_FILE_SYSTEM_LITTLEFS=y
    CONFIG_FAT_FILESYSTEM_ELM=n
    
    CONFIG_SHELL=y
    
    
    #USB related configs
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Zephyr MSC sample"
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_MASS_STORAGE=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_PID=0x0008
    CONFIG_DISK_DRIVER_FLASH=y
    CONFIG_APP_MSC_STORAGE_FLASH_FATFS=n
    
    # enable QSPI flash
    CONFIG_NORDIC_QSPI_NOR=y
    CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    
    CONFIG_SECURE_BOOT=n
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_CMSIS_DSP=y
    CONFIG_CMSIS_DSP_FASTMATH=y
    CONFIG_CMSIS_DSP_TRANSFORM=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_FPU=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    
    # Enable CAF_BUTTONS
    CONFIG_CAF=y
    CONFIG_CAF_BUTTONS=y
    CONFIG_CAF_BUTTONS_POLARITY_INVERSED=y
    CONFIG_CAF_CLICK_DETECTOR=y
    CONFIG_CAF_CLICK_DETECTOR_LONG_CLICK_MSEC=1000
    
    # normal voltage mode
    CONFIG_BOARD_ENABLE_DCDC_HV=n
    # disable NFC pin to GPIO
    CONFIG_NFCT_PINS_AS_GPIOS=y
    # Enable the memory DMA
    CONFIG_DMA=n
    
    # ADC config
    CONFIG_ADC=y
    
    # STEP 6.4 - Enable updates for the network core
    CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    

    ## pm_static.yml
    # Name of partition
    
    littlefs_storage:
      address: 0
      end_address: 0x3000000
      placement:
      before:
      - end
      region: external_flash
      size: 0x3000000
    
    

  • Hello,

    I am attaching a simple sample here for testing. I tested this here with NCS 2.4.2. Could you test if the same issue is happening with this sample? I also recommend trying by giving the swap type confirm only, not the swap type "Test and Confirm" from the NRF Connect app. Please delete the build folder from this file and try to test it.

    Kind Regards,

    Abhijith

    ,BLE_dfu_ota5340.zip

Related