mcuboot not recognizing the image to swap

Hi,

I am using nCS and mcuboot in my application for development, on nRF52833.

I build a nCS project, the build bin file (prj.conf as ):

CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=4

# General configuration
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_HWINFO=y
CONFIG_DK_LIBRARY=y

# Bluetooth configuration
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_L2CAP_TX_MTU=69
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
CONFIG_BT_OBSERVER=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SETTINGS=y

# Disable unused Bluetooth features
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
CONFIG_BT_CTLR_LE_ENC=n
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_CTLR_CHAN_SEL_2=n
CONFIG_BT_CTLR_MIN_USED_CHAN=n
CONFIG_BT_CTLR_PRIVACY=n

# Bluetooth Mesh configuration
CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_MESH_FRIEND=n
CONFIG_BT_MESH_ADV_BUF_COUNT=13
CONFIG_BT_MESH_RX_SEG_MAX=32
CONFIG_BT_MESH_TX_SEG_MAX=32
CONFIG_BT_MESH_PB_GATT=y
CONFIG_BT_MESH_GATT_PROXY=y
CONFIG_BT_MESH_DK_PROV=y
CONFIG_BT_MESH_TX_SEG_MSG_COUNT=20
CONFIG_BT_MESH_RX_SEG_MSG_COUNT=20
CONFIG_BT_MESH_SEG_BUFS=250
CONFIG_BT_MESH_MSG_CACHE_SIZE=50

# Enable Bluetooth mesh models debug logs
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_MESH_DEBUG=y
CONFIG_BT_MESH_DEBUG_MODEL=y

#external flash
CONFIG_SPI_NOR=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_SPI_NOR_SFDP_RUNTIME=n
CONFIG_SPI=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

#provisioning 
#CONFIG_BT_MESH_DEBUG_PROV_DEVICE=y

#mcuboot
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=32
# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

#CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y

I broke up into packets using a python script.

Futher these packets I transferred to my board via BLE and dumped into the serial flash, post dumping successfully,

I hard reset the board and got mcuboot logs as in the snap:

I do not understand why mcuboot is not recognizing my image to swap.

my partition is as:

external_flash:
  address: 0x00000
  end_address: 0x80000
  region: external_flash
  size: 0x80000

mcuboot_secondary:
  address: 0x00000
  device: IS25
  end_address: 0x64000
  region: external_flash
  size: 0x64000  

Am I missing something which marks the image trailer as to be copied..? 

I feel I am not rightly using img_mgmt_register_group();

Thanks,

Parents
  • Hi,

    I feel I am not rightly using img_mgmt_register_group();

    When are you calling the function? You should call it before bt_conn_auth_cb_register()

    Have you checked that the image is stored in the correct address, that is, the address where MCUboot looks for the image?

    Also check that the image that is put in the secondary slot is identical to the firmware image. You can do this by reading out the image from the device using nrfjprog and saving it to a file, then run diff on the two files to verify that they are the same.

    Best regards,

    Marte

  • Hi,

    Have you checked that the image is stored in the correct address, that is, the address where MCUboot looks for the image?

    Yes this i have checked and is in order.

    I have a image which is getting recognized by mcuboot and being swapped upon comparing the hex format of this working image and my image which is not being copied, I realized that there was a difference of image trailers.

    My image trailer was completely unmarked, while in the working image had trailer marked and populated by data.

    I read that img_mgmt_register_group(); marks the trailers appropriately. 

    I need to know how to go about this in my application to call and mark the image trailer.

    Thanks

  • Hi,

    How are you sending the image with BLE? Are you using another Nordic device, a third party device, a phone or a computer? Are you using the SMP Bluetooth service?

    Best regards,

    Marte

  • Hi,

    I am sending it via BLE-Mesh protocol, another device is acting as a client and sending the image to my device.

    I validated that the transfer and reception is right, I even read the byte data post complete image reception, which is also correct.

    Are you using the SMP Bluetooth service?

    No,

    As SMP yet doesn't support BLE-Mesh, the application on my receiving device uses no SMP.
    Here is where I am looking at, my download is complete on receiving device, what other APIs i need to use to mark my downloaded image to be recognized and swapped by mcuboot..?

  • Hi,

    Did you sign the image? Can you try using imgtool to sign the image with the --pad argument? This will place a trailer on the image.

    Best regards.

    Marte

Reply Children
Related