softdevice taking more RAM on SDK 12


  1. In the newer versions of NRF 5 SDK (sdk10 vs sdk12), does the softdevice takes more RAM? I am using nrf51822 (qfaa) and sdk 12.3. with softdevice s130_2.0.0.1. I want to use 1 peripheral and 1 central link. The Ram requirement is 0x25e0.

In my past project, I have used sdk 10 and softdevice s130_2.0.0-4.alpha. with similar requirements but the softdevice was only consuming 0x2220 bytes. Is this because of newer version of SDK?

  1. Since I am using package with 16kb RAM (qfaa) I don't have enough RAM to run both peripheral and central at same time. I want to communicate between 2 nordic devices. Both devices scan/advertise at the same time and when they discover each other, device with lower MAC ID becomes master and other becomes slave. Is there any way I can implement this without having both peripheral and central enabled at the same time ?

edit: Just wanted to double check, is it possible the RAM requirements might have increased by about 0x3C0 bytes for softdevice s130_2.0.1 compare to s130_2.0.0-4.alpha ?

  • No, it's always linked to Soft Device version not SDK. If you change SD version then expect changes in memory layout. Each Soft Device is accompanied with release notes which clearly say what are hard limits. The rest must be found experimentally as if you would change BLE configuration before SD enabling (= the same way you found your previous values). And yes, different SDK versions come with different SD so either you need to change HEX and H files in SDK to match SD version you like or change flash/RAM limits in loader script (+ sometimes there can be changes in SD API!) to match new version from SDK.

    Regarding your second question you have obvious options:

    • Optimize your application so i can fit into RAM (there is always space for improvements;).
    • Change your BLE "protocol" architecture to use Central/Peripheral only devices.
    • Keep GAP roles but play with other parameters influencing SD ARM allocation (ATT table size, link bandwidth etc.)
    • Go with 32kB RAm variant of nRF51.
    • Go with other SD version which has lower RAM needs (yes, that probably means less features and more bugs then latest S130 V2.0.1).
    • Use different radio protocol then BLE (so you don't need full stack) - yes I know. this is extreme;)
    • Use different BLE stack then Nordic Soft Device (e.g. Zephyr or Mynewt projects can maybe offer some reasonable options) - yes, that would basically mean start application development from scratch.
  • From release document:

    • S130 V2.0.0-alpha.4 base RAM allocation = 4.6 kB (0x1268 bytes)
    • S130 V2.0.1 base RAM allocation = 4.95 kB (0x13C8 bytes)

    However this is just typical allocation, they don't list minimal RAM requirements or any other point. As memory allocation mechanism isn't linear and it's subject of change (as internals of SD are evolving) I'm not surprised that for similar configuration the difference can make up to 1kB as you suggest. Note that the original you use is marked as ALPHA which means that API should be stable but internal mechanisms - including memory allocations, both flash and RAM - are subject of change. And they changed;) Also S130 V2.0.1 was released in May 2016, I so no excuse of using alpha versions in October 2017!

  • thanks! I am not using older versions, just comparing with a past project!