MCUMGR is stuck after a flash of a big image

Hi, 

If the image we falshed using mcumgr is 90% of the allowed image size mcumgr flashes the unit without a problem, If the image is 98% the proccess seems stuck.

This is the image list:

root@tina:~# mcumgr --conntype serial --connstring /dev/ttyS4,baud=115200 image 
 list
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: feb4706e9a332137daf3016bd2c810885ac4139d67e2242b0f2d4cceda1c7b0e
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending permanent
    hash: 2c8963914df5985f7141b5c1525ac8f1ebefd332d12e4dda9d0ea770634fc473
Split status: N/A (0)

image erase is not working as well and will return Error: 6.

How can we remove the 2nd image and flash the unit again?

Your help would be greatly appreciated, 

  • HI  , coming back to this thread..

    In our prj.conf we have:

    CONFIG_BOOTLOADER_MCUBOOT=y 

    Can you please elaborate on what did you mean "serial recovery"

  • Hi,

    "serial recovery" is when you have a serial DFU transport (USB or UART) enabled in the bootloader itself. This allows DFU to be performed within the bootloader. 

    https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/exercise-1-dfu-over-uart/ 

  • Thanks, Here's our prj.conf, anything else we can do?

    # Enable mcumgr.
    CONFIG_MCUMGR=y
    
    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    
    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Enable the serial mcumgr transport.
    CONFIG_MCUMGR_SMP_UART=y
    CONFIG_NET_BUF_USER_DATA_SIZE=7
    
    # Disable UART Console and enable the RTT console
    CONFIG_UART_MCUMGR=y
    
    CONFIG_UART_CONSOLE_MCUMGR=y
    
    CONFIG_NFCT_PINS_AS_GPIOS=y
    
    CONFIG_CONSOLE_SUBSYS=y
    CONFIG_CONSOLE_GETLINE=y
    
    # Add support for temperature sensor
    CONFIG_NRFX_TEMP=y
    
    #For analog read:
    CONFIG_ADC=y
    
    # BT configuration 
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    CONFIG_BT_DEVICE_NAME_MAX=128
    CONFIG_BT_BROADCASTER=y
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_DEBUG_LOG=n
    
    
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    
    CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
    
    #CONFIG_LOG=y
    
    # CONFIG_LOG_BUFFER_SIZE=1024
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_GATT_CLIENT=y
    # CONFIG_BT_NUS=y
    CONFIG_BT_GATT_DM=y
    # CONFIG_BT_SMP=y
    # CONFIG_BT_SIGNING=y
    # CONFIG_BT_DIS=n
    # CONFIG_BT_ATT_PREPARE_COUNT=5
    # CONFIG_BT_BAS=n
    # CONFIG_BT_HRS=n
    # CONFIG_BT_PRIVACY=y
    # CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
    # todo: this have conflicts with the settings 
    #CONFIG_BT_SETTINGS=y
    
    CONFIG_BT_DEBUG_NONE=y
    CONFIG_BT_ASSERT=n
    CONFIG_BT_DATA_LEN_UPDATE=n
    CONFIG_BT_PHY_UPDATE=n
    CONFIG_BT_GATT_CACHING=n
    CONFIG_BT_GATT_SERVICE_CHANGED=n
    CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
    CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y
    CONFIG_BT_HCI_VS_EXT=n
    
    
    # CONFIG_SETTINGS=y
    # CONFIG_SETTINGS_RUNTIME=y
    
    # CONFIG_FLASH=y
    # CONFIG_FLASH_PAGE_LAYOUT=y
    # CONFIG_FLASH_MAP=y
    # CONFIG_NVS=y
    
    #CONFIG_NEWLIB_LIBC=y
    
    # CONFIG_CBPRINTF_NANO=y
    # CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    CONFIG_MAIN_STACK_SIZE=1024
    
    CONFIG_POSIX_API=y
    
    CONFIG_BT_GATT_DM_MAX_ATTRS=50
    
    

  • Serial recovery is something that must be enabled in the MCUBoot child-image. Please refer to the link in my previous comment for details.

Related