“The OTA update is failing due to an application size issue on the nRF52833 controller

Hello Nordic Team,

I am working on OTA functionality using nRF Connect SDK 2.9.0 on the nRF52833 controller.

Earlier, my application size was around 320 KB, and I reduced it to approximately 237 KB. However, when I try to build the firmware or perform the OTA update, I still encounter an application size-related issue.

I am also using RTOS and several BLE functionalities in the application.

Could you please let me know whether OTA will work with this application size, or if any additional configuration or partition changes are required? I will also share my prj.conf file for reference.

Thank you.

prj conf

# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

########################
# CORE SYSTEM
########################

CONFIG_REBOOT=y

#CONFIG_PWM=y

CONFIG_POWEROFF=y
CONFIG_PM_DEVICE=y
CONFIG_NRFX_POWER=y
# Remove CONFIG_PM=y — it is NOT needed and may silently fail on nRF52833

# Main and workqueue stacks
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

# Heap
CONFIG_HEAP_MEM_POOL_SIZE=4096

# Extra stacks – tune down later with thread analyzer if needed
CONFIG_MPSL_WORK_STACK_SIZE=2048
CONFIG_BT_RX_STACK_SIZE=2048
CONFIG_IDLE_STACK_SIZE=1024
CONFIG_ISR_STACK_SIZE=2048



########################
# BLUETOOTH – ROLES
########################

CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y



CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y
CONFIG_BT_FIXED_PASSKEY=y  # Make sure this is disabled

# Device name
CONFIG_BT_DEVICE_NAME="CODE_OPTIMIZE"
#CONFIG_BT_DEVICE_NAME="HANDHELD_SAGAR"

########################
# BLUETOOTH – BUFFERS
########################

# ACL data buffers
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_RX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251

# L2CAP
CONFIG_BT_L2CAP_TX_MTU=247
#CONFIG_BT_L2CAP_TX_BUF_COUNT=5
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y

# Controller
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

########################
# GATT & CLIENTS
########################

CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_DM=y
#CONFIG_BT_GATT_DM_DATA_PRINT=y

# Nordic UART Service client
CONFIG_BT_NUS_CLIENT=y


########################
# SCANNING & CONNECTION MGMT
########################

CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
CONFIG_BT_SCAN_NAME_CNT=1
CONFIG_BT_SCAN_AND_INITIATE_IN_PARALLEL=y

# Connection parameters (peripheral preference)
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=12
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=12
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400

# Request security automatically for GATT
CONFIG_BT_GATT_AUTO_SEC_REQ=y

########################
# FLASH & NVS (FOR SETTINGS/BONDING)
########################

CONFIG_FLASH=y
CONFIG_SOC_FLASH_NRF=y
CONFIG_NRFX_NVMC=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# NVS and settings backend
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y

########################
# BLUETOOTH SECURITY / BONDING
########################

CONFIG_BT_BONDABLE=y
CONFIG_BT_SETTINGS=y         # Store bonds in settings (flash) [[Exercise 2](https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-5-bluetooth-le-security-fundamentals/topic/blefund-lesson-5-exercise-2/)]
CONFIG_BT_PRIVACY=y
CONFIG_BT_RPA_TIMEOUT=900


########################
# GPIO / WDT / CLOCK
########################

CONFIG_GPIO=y

CONFIG_WATCHDOG=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y


########################
# LOGGING
########################

CONFIG_LOG=n
CONFIG_LOG_MODE_IMMEDIATE=n

CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=n

CONFIG_BT_CONN_CHECK_NULL_BEFORE_CREATE=y

# Limit BT log noise (warning level)
CONFIG_BT_LOG_LEVEL_WRN=n
CONFIG_BT_CONN_LOG_LEVEL_WRN=n
CONFIG_BT_ISO_LOG_LEVEL_WRN=n
CONFIG_BT_HCI_DRIVER_LOG_LEVEL_WRN=n


########################
# DEBUG / OPTIMIZATION
########################
#CONFIG_DEBUG_OPTIMIZATIONS=y
#CONFIG_DEBUG_THREAD_INFO=y
#CONFIG_INIT_STACKS=y


# Bluetooth Security
CONFIG_BT_SMP=y
#CONFIG_BT_SIGNING=y
#CONFIG_BT_SMP_SC_ONLY=y
#CONFIG_BT_SMP_SC_PAIR_ONLY=y

CONFIG_SETTINGS_RUNTIME=y
CONFIG_BT_MAX_PAIRED=7

# Whitelist/Filter Accept List Support
CONFIG_BT_FILTER_ACCEPT_LIST=y

# Bond Management Service
#CONFIG_BT_BMS=y
#CONFIG_DK_LIBRARY=y

# Connection parameters
CONFIG_BT_MAX_CONN=7
CONFIG_BT_L2CAP_TX_BUF_COUNT=7

# Flash partitions (already present but ensure they exist)
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x2000


# I2C Configuration
CONFIG_I2C=y
CONFIG_I2C_NRFX=y

# ADC Driver Configuration
CONFIG_ADC=y
CONFIG_ADC_NRFX_SAADC=y



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_HCI_VS_EXT=n
CONFIG_BT_ASSERT=n          
CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_CTLR_PHY_2M=n

CONFIG_SIZE_OPTIMIZATIONS=y
CONFIG_MINIMAL_LIBC=y
###########################################//OTA CONFIGURATION ######################

################OTA RELATED CONFIGH###################

# Enable MCUboot bootloader
CONFIG_BOOTLOADER_MCUBOOT=y

# BLE DFU via MCUmgr (recommended helper)
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

# Optional: speed up DFU, automatically extends BT buffers & data length
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y





# Device Information Service
CONFIG_BT_DIS=y
CONFIG_BT_DIS_FW_REV=y

Parents
  • Hi,

    As you have problems fitting the application of 237 kB I assume you do not have external flash for the secondary image? If so, the maximum application region will be 232 kB, and that is if you do not use the settings subsystem or need flash for anything other than the application and bootloader. For the normal case where you use transport in the bootloader (which I see you have enabled in Kconfig so I will assume you need it), you will need to fit the application twice, pluss the bootloader. Then the flash memory layout will look like this when building the smp_svr sample for nRF52 DK:

    There are some options (some of which may not suit your situation):

    1. Find a way to reduce the application size a bit further to make it fit

    2. Use external flash for the secondary slot

    (For reference, the latest nRF Connect SDK has a new Single-slot DFU with MCUboot, but this is only supported on the nRF54L series)

Reply
  • Hi,

    As you have problems fitting the application of 237 kB I assume you do not have external flash for the secondary image? If so, the maximum application region will be 232 kB, and that is if you do not use the settings subsystem or need flash for anything other than the application and bootloader. For the normal case where you use transport in the bootloader (which I see you have enabled in Kconfig so I will assume you need it), you will need to fit the application twice, pluss the bootloader. Then the flash memory layout will look like this when building the smp_svr sample for nRF52 DK:

    There are some options (some of which may not suit your situation):

    1. Find a way to reduce the application size a bit further to make it fit

    2. Use external flash for the secondary slot

    (For reference, the latest nRF Connect SDK has a new Single-slot DFU with MCUboot, but this is only supported on the nRF54L series)

Children
No Data
Related