MCU BOOT and DFU not working

I am developing with nRF2.3.0 on Windows 11.  We have a custom board nRF52832-QFAA.  The application is quite large and works well when flashed to the board.  We need to add OTA DFU over BLE capability and I have yet to make it work.

1) In a debug build the application boots properly and works as expected.  Since the application is large, I have to turn off all debug to get it to build without overrunning FLASH and RAM.  I have gotten it to this point.  

2) When I flash this image on the board with MCUMGR enabled, nothing happens.  The application doesn't wok at all, the board isn't in any of the states i expect it to be in.  This is difficult because i cant have any debugging enabled.  I should be able to see an LED come on after boot but that doesn't even happen.  Any logging I would be doing comes over SEGGER_RTT but as i said it is disabled.

This is my conf file:

#required for debugging this chipset
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

#MCU Manager
CONFIG_MCUMGR=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_STAT_MGMT=y

#memory settings
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
CONFIG_MAIN_STACK_SIZE=2048

#Thread settings
CONFIG_THREAD_NAME=y
CONFIG_THREAD_MONITOR=y

#Enable statistics (MCU ADDED)
CONFIG_STATS=y
CONFIG_STATS_NAMES=y

#setup the flash config
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_SOC_FLASH_NRF=y

# Support for taskstat command
CONFIG_OS_MGMT_TASKSTAT=y

#setup the bluetooth config
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y  #required for FOTA
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y

#Bluetooth settings
CONFIG_BT_BUF_ACL_RX_SIZE=256
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255

CONFIG_BT_L2CAP_TX_MTU=252
#CONFIG_MCUMGR_SMP_BT=y
#CONFIG_MCUMGR_SMP_BT_AUTHEN=n
#CONFIG_SHELL=y
#CONFIG_MCUMGR_SMP_SHELL=y

#debug settings
#CONFIG_BT_DEBUG_LOG=y
#CONFIG_CONSOLE=y
#CONFIG_LOG_BACKEND_RTT=y
#CONFIG_LOG_DEFAULT_LEVEL=4
#CONFIG_USE_SEGGER_RTT=y
#CONFIG_RTT_CONSOLE=y
#CONFIG_PRINTK=y
#CONFIG_LOG_PRINTK=y
#CONFIG_CBPRINTF_FP_SUPPORT=y
#CONFIG_LOG=y
#CONFIG_LOG_MODE_IMMEDIATE=y

#GPIO and ADC settings
CONFIG_GPIO=y
CONFIG_ADC=y
CONFIG_NRFX_SAADC=y
CONFIG_BT_DEVICE_NAME="Device-name"

This is the final output from the compile:

Memory region Used Size Region Size %age Used
FLASH: 229732 B 237056 B 96.91%
RAM: 62984 B 64 KB 96.11%
IDT_LIST: 0 GB 2 KB 0.00%
[255/263] Generating ../../zephyr/app_signed.hex
sign the payload
[256/263] Generating ../../zephyr/app_update.bin
sign the payload
[257/263] Generating ../../zephyr/app_test_update.hex
sign the payload
[259/263] Generating ../../zephyr/app_moved_test_update.hex
[261/263] No install step for 'mcuboot_subimage'
[262/263] Completed 'mcuboot_subimage'
[263/263] Generating zephyr/merged.hex

I have flashed merged.hex to the board.

I am at a loss as to what to do next. nothing I have found online as helped.  The first priority is to have MCUBOOT enabled and have the application run as usual.

Thanks

Parents Reply Children
  • Ok I will work on that.  However what does this have to do with the application running?  It compiles, it uses most of the FLASH and RAM but it loads on the board.  It just isn't running.  Could you provide a little explanation what resizing will do to help my problem?  I am reading through the provided information now and will re-post when i have another question.  It doesn't seem like ill be able to increase the partition size though because from what i understand I need equal slot 0 and slot 1 sized areas and I don't have that space to increase.

    Additionally I have tried making the peripheral_hr application and loading on the nrf52_dk board and adding MCUBOOT to that as well.  While that application runs, it wont update.  The Nordic DFU Application connects, and fails with an error saying it cant make an update from the dfu_application.zip file.

  • Well I cannot find anything that looks like an MCUBOOT config file. 

    I don't know what you mean about : For doing this create a child image folder inside the Application and enable the configuration.

    I have been able to get the peripheral_lbs application to build with MCUBOOT and update that via BT OTA.  still no luck on my custom board.

    I looked at the Partition Manager Link, there is no Memory Layout.  As for the next link "this thread" I understand what its doing and could change the layout but that seems to indicate tat my application isn't fitting into the slot and it certainly seems to be.  If I do need to increase it, how much does it need to increase?  Is there some sort of unwritten rule about size and maybe some extra free space needed?

    My latest build: 

    Memory region Used Size Region Size %age Used
    FLASH: 29260 B 48 KB 59.53%
    RAM: 22400 B 64 KB 34.18%
    IDT_LIST: 0 GB 2 KB 0.00%
    [235/256] Linking C executable zephyr\zephyr_pre0.elf

    [239/256] Linking C executable zephyr\zephyr_pre1.elf

    [245/256] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 217716 B 237056 B 91.84%
    RAM: 61568 B 64 KB 93.95%
    IDT_LIST: 0 GB 2 KB 0.00%
    [248/256] Generating ../../zephyr/app_update.bin
    sign the payload
    [250/256] Generating ../../zephyr/app_signed.hex
    sign the payload
    [251/256] Generating ../../zephyr/app_test_update.hex
    sign the payload
    [252/256] Generating ../../zephyr/app_moved_test_update.hex
    [254/256] No install step for 'mcuboot_subimage'
    [255/256] Completed 'mcuboot_subimage'
    [256/256] Generating zephyr/merged.hex

    generates all required files, it still doesnt boot though.

    This is the flash section of the dts file that i believe is being used.

    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x3e000 0x32000>;
    		};
    		scratch_partition: partition@70000 {
    			label = "image-scratch";
    			reg = <0x70000 0xa000>;
    		};
    		storage_partition: partition@7a000 {
    			label = "storage";
    			reg = <0x7a000 0x6000>;
    		};
    	};
    };
    

    This is the partition manager report:


    [1/1] cmd.exe /C "cd /D C:\Users\xxxxx\source\repos\xxxxxx...xxxxx/source/repos/xxxxxx_controller/build/partitions.yml"
    flash_primary (0x80000 - 512kB):
    +-------------------------------------------------+
    | 0x0: mcuboot (0xc000 - 48kB) |
    +---0xc000: mcuboot_primary (0x3a000 - 232kB)-----+
    | 0xc000: mcuboot_pad (0x200 - 512B) |
    +---0xc200: mcuboot_primary_app (0x39e00 - 231kB)-+
    | 0xc200: app (0x39e00 - 231kB) |
    +-------------------------------------------------+
    | 0x46000: mcuboot_secondary (0x3a000 - 232kB) |
    +-------------------------------------------------+

    sram_primary (0x10000 - 64kB):
    +-------------------------------------------+
    | 0x20000000: sram_primary (0x10000 - 64kB) |
    +-------------------------------------------+

    I am running out of time to make this work, everything I've read says what I've done should work but i cant even get it to BOOT!  we need to test and ship this in a week!

    --brian

Related