I have a custom nRF52840 design, I'm actually using a ublox BMD-340-A-R module on a custom board. I have a working application with BLE peripheral, I2C sensors, USB CDC, LoRaWan and some RS485 interfaces. I am using NCS 2.5.2. The application is working as intended and I now want to add mcuboot for OTA DFU firmware updates. In the application I have console and logging disabled as I am using the UARTs for the RS485 interfaces so they are not available (practically all pins are in use).
Now, I've tried to add mcuboot by adding CONFIG_BOOTLOADER_MCUBOOT=y in prj.conf and a child_image/mcuboot.conf (shown below). If I connect to the device using nRFConnect App I can see that DFU service is available. If I press the DFU icon and load the app_distribution.zip it appears as if the file is uploaded (I get the transfer speed chart and the progress goes on to 100%) but right after the upload when the progress switches to "Validating..." the nRF52 reboots and gets stuck somewhere. If I power cycle the board the device comes back up but it is on the original firmware.
I'm not very familiar with mcuboot so I'm not sure what to check or try. Below are all of the file the I think are relevant.
prj.conf:
CONFIG_GPIO=y CONFIG_SERIAL=y CONFIG_UART_0_ASYNC=y CONFIG_UART_1_ASYNC=y CONFIG_UART_ASYNC_API=y CONFIG_CONSOLE=n CONFIG_UART_CONSOLE=n CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="dtu proto" CONFIG_BT_DEVICE_APPEARANCE=833 CONFIG_BT_MAX_CONN=1 CONFIG_BT_MAX_PAIRED=1 # Enable bonding CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_NVS=y CONFIG_SETTINGS=y # Config logger CONFIG_LOG=n CONFIG_USE_SEGGER_RTT=n CONFIG_LOG_BACKEND_RTT=n CONFIG_LOG_PRINTK=n CONFIG_ASSERT=y CONFIG_GPIO_AS_PINRESET=n # Enable USB CONFIG_USB_DEVICE_STACK=y CONFIG_USB_CDC_ACM=y CONFIG_USB_WORKQUEUE=y CONFIG_USB_WORKQUEUE_STACK_SIZE=8192 CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_CBPRINTF_FP_SUPPORT=y CONFIG_SHELL=n CONFIG_LORA=y CONFIG_SPI=y CONFIG_ADC=y CONFIG_LORA_SX127X=y # Enable the LoraWAN stack CONFIG_LORAWAN=y #CONFIG_LORAWAN_LOG_LEVEL_DBG=y CONFIG_HAS_SEMTECH_LORAMAC=y CONFIG_HAS_SEMTECH_SOFT_SE=y CONFIG_HAS_SEMTECH_RADIO_DRIVERS=y # Configure LoraWAN Region to be used CONFIG_LORAMAC_REGION_EU868=y CONFIG_INIT_STACKS=y CONFIG_THREAD_STACK_INFO=y CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192 CONFIG_NO_OPTIMIZATIONS=n CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y CONFIG_PWM=y CONFIG_PWM_NRFX=y CONFIG_MCUMGR=y CONFIG_MCUMGR_TRANSPORT_BT=y
child_image/mcuboot.conf:
CONFIG_SHELL=n CONFIG_LOG=n CONFIG_CONSOLE=n CONFIG_GPIO_AS_PINRESET=n CONFIG_BOOT_SIGNATURE_TYPE_RSA=y CONFIG_MULTITHREADING=y
pm_static.yml (copied from partition.yml)
app: address: 0xc200 end_address: 0x85000 region: flash_primary size: 0x78e00 mcuboot: address: 0x0 end_address: 0xc000 placement: before: - mcuboot_primary region: flash_primary size: 0xc000 mcuboot_pad: address: 0xc000 end_address: 0xc200 placement: align: start: 0x1000 before: - mcuboot_primary_app region: flash_primary size: 0x200 mcuboot_primary: address: 0xc000 end_address: 0x85000 orig_span: &id001 - app - mcuboot_pad region: flash_primary sharers: 0x1 size: 0x79000 span: *id001 mcuboot_primary_app: address: 0xc200 end_address: 0x85000 orig_span: &id002 - app region: flash_primary size: 0x78e00 span: *id002 mcuboot_secondary: address: 0x85000 end_address: 0xfe000 placement: after: - mcuboot_primary align: start: 0x1000 region: flash_primary share_size: - mcuboot_primary size: 0x79000 settings_storage: address: 0xfe000 end_address: 0x100000 placement: align: start: 0x1000 before: - end region: flash_primary size: 0x2000 sram_primary: address: 0x20000000 end_address: 0x20040000 region: sram_primary size: 0x40000