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

how determine required ram size that soft device need

hi to all,

i am developing a device with nrf51822 and i have Inadequate ram problem, i know that softdevice required ram determined in runtime, so there is any way to know roughtly soft device require how much ram in rumtime(functions that i call or etc) ??

  • The SoftDevice will actually tell you if you have allocated to little RAM, i.e. it will return the application RAM start address. You can start a debug session with a breakpoint after the sd_ble_enable() call in nrf_sdh_ble_enable() in nrf_sdh_ble.c

    If you have RTT logging enabled( should be enabled by default in the ble_app_template example) then the RTT output will be displayed in the Debug Terminal in Segger Embedded Studio, as shown in the screenshot below.

    It is also possible to use the UART backend instead of the RTT backend by setting NRF_LOG_BACKEND_RTT_ENABLED to 0 and NRF_LOG_BACKEND_UART_ENABLED to 1 insdk_config.h. In both cases you'll see the following output in the Debug Terminal/Serial TErminal/RTT Viewer if you have allocated to little RAM for the SoftDevice:

    <warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
    <warning> nrf_sdh_ble: Change the RAM start location from 0x20002210 to 0x20002220.
    <warning> nrf_sdh_ble: Maximum RAM size for application is 0xDDE0.
    <error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\Nordic_Semiconductor\SDK_Repository\nRF5_SDK\nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\custom_ble_service_example\main.c:663
    PC at: 0x0002EF37

    Best regards

    Bjørn

Related