This page applies to BSP 0.8.0 and higher, which introduced bootloader v5.1.0 and S132 v5.x.x. For earlier releases (BSP release < 0.8.0) see bootloader v0.5.0 and S132 v2.x.x at the bottom of this page.

BSP release & Bootloader version

The memory usage depends on the version of the Softdevice and/or bootloader (single/dual bank). Following is the Bootloader and Softdevice version included with BSP release

- 0.9.x :nRF52832 S132 v6.1.1 single bank andnRF52840 S140 v6.1.1 single bank

- 0.8.x :nRF52832 S132 v2.0.1 dual banks and S132 v5.1.0 dual banks

- 0.7.x and older:nRF52832 S132 v2.0.1 dual banks

Starting from BSP 0.9.x only single banks will be used to maximize the flash storage

Flash Memory

The nRF52832 has 512 KB flash, nRF52840 has 1024 KB flash. The flash layout varies as follows:

  • SoftDevice: This section of flash memory contains the Soft Device, which is Nordic's black box Bluetooth Low Energy stack.
  • Application: This section of flash memory stores the user sketches that you compile in the Arduino IDE.
  • Reserved: This section of flash memory is kept empty to enable dual banks safe firmware updates. Whenever you try to update the Application are, the new application data will first be written to the free memory section, and the verified before it is swapped out with the current application code. This is to ensure that DFU complete successfully and that the entire image is safely store on the device to avoid losing the application code. This region is not used by single bank bootloader
  • User Data: This 28KB section of flash memory is reserved for config settings. It uses an open source file system called Little File System, which is a part of ARM Mbed OpenSource to store bonding data. For example, when you bond the nRF52 with another Central device.
  • DFU Bootloader: This section of flash memory stores the actual bootloader code that will be executed by the MBR described earlier.

SRAM Layout

The nRF52832 has 64KB of SRAM available, and actual memory use will depend on your project, although the stack and heap memory locations are described below:

  • Soft Device: amount of SRAM exclusive allocated for SoftDevice by Linker script. The size is subject to change and varies by releases. For BSP release 0.8.0 it is 12.5 KB. However, the actual memory required by the SoftDevice depends on the  run-time configuration determined by Bluefruit's configNNN() API.
  • Sketch BSS: static and global data used by your sketch.
  • Heap Memory: The largest memory region, this is used for allocating the real time operating systems (RTOS) thread stack, malloc() etc. The size, based on the variables shown below, is Y = 64 - 12.5 - X - 2 ( KB ), where 12.5KB will vary depending on the SoftDevice used.
  • Stack Memory: Used by non RTOS thread code, this is mostly for Interrupt Service Routines (ISRs) and SoftDevice API calls. The current size is 2 KB.

Functions affecting SoftDevice SRAM usage

The Bluefruit nRF52 configNNN() functions set the behavior of SoftDevice, thus determining the total SRAM usage. These functions must be called before begin().

  • configUuid128Count() : Defines the number of UUID128 entries that the SoftDevice supports, e.g Bleuart, BleMidi, or other services and characteristics. Default value is 10. 
  • configAttrTableSize(): The total size of the attribute table, which holds services and characteristics. If your application needs lots of characteristics you may need to increase this. Default value is 2048 bytes.
  • configPrphConn(), configPrphBandwidth(): These function set the parameters that determine the bandwidth for peripheral's connections. configPrphBandwidth() is a convenient helper that calls configPrphConn() with appropriate parameters.
  • configCentralConn(), configCentralBandwidth(): These functions set the parameters that determine the bandwidth for central mode connections. configCentralBandwidth() is a convenient helper that calls configCentralConn() with appropriate parameters.
  • begin(): Bluefruit nRF52's begin() function also affects the bandwidth since it takes 2 (optional) parameters. The first one is the number of concurrent connections for peripheral links (to mobile phones, your computer, etc.), the second one is the number of central links (to BLE accessories, or another feather52 running in peripheral mode). The maximum number of concurrent connections for SoftDevice v5.x is 20.
If you run into an error message saying "SoftDevice require more SRAM than provided by linker", try altering your system config -- for ex. lower bandwidth, fewer connection or a smaller attribute table size. Another advanced option is to modify the linker script, but this should be done with care and knowledge of what you are changing.
Download: file
[CFG] SoftDevice config requires more SRAM than provided by the linker.
App Ram Start must be at least 0x20004180 (provided 0x20003200).
Please update linker file or re-config SoftDevice.
This guide was first published on Jan 02, 2019. It was last updated on Jan 02, 2019.
This page (Memory Map) was last updated on Oct 25, 2020.