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

softdevice_enable: NRF_ERROR_NO_MEM, 0x4

I'm trying to make the nRF51422xxAC advertise. Using Segger Embedded Studio.

I have this code: bpaste.net/.../f29f74986c10

On line 109, I have a breakpoint. At that point in the code, err_code = 4, and after that, the nRF resets.

#define 	NRF_ERROR_NO_MEM   (NRF_ERROR_BASE_NUM + 4)
 	No Memory for operation. 

I have tried with different SRAM_START in the Linker settings: from 0x20001FE8 up to 0x20007000. The chip should have 0x8000 bytes of memory if I read correctly. Anyway - I get the same behaviour every attempt.

I have looked at other forum posts but haven't found anything directly applicable. Line 105 is from trying one of the solutions to no avail.

From the softdevice_enable documentation:

If the app_ram_base is too low, this function will return an error. Using a app_ram_base that is too high will not fail, but will result in RAM that is never used

But I can't find any further information on how much memory is needed. However, I would be surprised if a bigger SRAM_START than 0x20007000 is needed... The problem is probably something else.

  • Hi Erlend,

    Have you tried to search similar questions about ble_stack_init(...) function on this forum? I'd recommend this one as an example. It solves your problem for GCC but I hope that SES will have very similar construct for any SoftDevice S13x V2 or newer (just find equivalent of __data_start__ external variable if it isn't the same). Not sure if SRAM_START is equivalent of RAM memory segment in GCC linker script (LD file), that would explain the failure as well.

    Cheers Jan

  • Thanks for the answer! I found out that __data_start__ is the one, as I'm using GCC (Linux). Then I replaced the line err_code = softdevice_enable(&ble_enable_params); (line 108) with this code:

    uint32_t app_ram_base = (uint32_t) &__data_start__;
    err_code = sd_ble_enable(&ble_enable_params, &app_ram_base);
    
    uint32_t should_be = app_ram_base;
    uint32_t is = (uint32_t) &__data_start__;
    debug_dummy = 4;
    

    And put a breakpoint on the last line - at which is = 0x20001f00 and should_be = 0x20001ff8. It seems like setting SRAM_START in the Linker Options indeed does not work! Here is my flash_placement.xml file: bpaste.net/.../c42014e0f8c3

    Edit: I tried to set RAM_START instead of SRAM_START and everything now works! Thanks!

  • Glad to hear it works for you;) God bless GCC makefiles and linker scripts, no XML or even worse things;)

Related