This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How does Peripheral role configuration affect the RAM impact of s132?

I've just added a 4th Peripheral-role link to my project, and the RAM requirement for the SoftDevice increased by over 3kB. I'm trying to figure out whether I can reduce this.

I'm using s132 v5.1.0. Section 14.3 of the SD Spec gives role configuration (as well as the number) as one of the factors determining SD RAM usage, and points to Section 10.4. This section says "The size of the memory pool for a connection is determined by the ATT MTU and the event length (duration) of the connection."

So, I adjusted the  NRF_SDH_BLE_GATT_MAX_MTU_SIZE down a couple of times, and for every byte, the SD required >40 fewer (10 per connection?) bytes! Why such a huge change?

I also tried adjusting the NRF_SDH_BLE_GAP_EVENT_LENGTH, but that didn't seem to do anything. Why not?

I'm measuring RAM requirement by observing the argument of sd_ble_enable() after each build-load-run.

  • Hi,

    The various layers in the stack all create individual buffers per link. So multiple buffers are created each time you add another link and their length is varying dependent on your MTU size. 

    The GAP Event length does indeed impact RAM requirements, but how much (if anything at all) depends on the event length relative to the packet length. I did some quick tests:

    Link Count MTU size Event length RAM requirements
    1 23 3 8416
    1 247 3 10064
    1 247 4 10064
    1 247 6 10584

    You can see that if I increase the event length from 3 to 4 nothing happens, but if I double the value to 6 the RAM requirements increase by 520 bytes. 

  • Hi,

    The various layers in the stack all create individual buffers per link. So multiple buffers are created each time you add another link and their length is varying dependent on your MTU size. 

    The GAP Event length does indeed impact RAM requirements, but how much (if anything at all) depends on the event length relative to the packet length. I did some quick tests:

    Link Count MTU size Event length RAM requirements
    1 23 3 8416
    1 247 3 10064
    1 247 4 10064
    1 247 6 10584

    You can see that if I increase the event length from 3 to 4 nothing happens, but if I double the value to 6 the RAM requirements increase by 520 bytes. 

Related