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

SD 132 increasing RAM

I have modified the experimental_ble_eddystone app to be a connectable beacon. To do this I need to increase the peripheral_link_count to 1 from 0. In others words I want to make it a connectable beacon.

I get err_code 12 when I enable the softdevice by err_code = softdevice_enable(&ble_enable_params).

I guess I need to increase the RAM size given the connection. How much do I increase the RAM and where. I am using Keal and SD132 2.0.0.2 alpha.

Thanks!

  • If you're using 2.0.0-2 alpha then NRF_ERROR_NO_MEM, as it tells you in the documentation, means you need to reduce the size of the attribute table.

    If you move to a later release, I think anything after 2.0.0-7, that allows you to adjust the amount of memory used by the softdevice instead so the whole thing is completely tuneable. In that case the error code returned changes and the enable call changes to take a pointer to the start of user memory.

    So either reduce your attribute table size if you want to continue on that version of the softdevice, or make the changes to move to the latest one and tune the attribute table size and the memory.

  • Thanks RK I have installed 2.0.0-7 and I have the following issue.

    define PERIPHERAL_LINK_COUNT 1

    err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params);

    err_code = softdevice_enable(&ble_enable_params);

    results in err_code =12

    It works fine (err_code = 0) when I have

    define PERIPHERAL_LINK_COUNT 0 err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params);

    err_code = softdevice_enable(&ble_enable_params);

  • I solved the problem for 1 peripheral connection. I adjusted the iRAM settings in Keal to 0x20001f00 and size 0x6100. This works. The default values in the app for the 0 peripheral case was 0x20001860 0x67a0.

    I wish there was a formula to determine the memory settings based on the number of connections. Seems like trial and error is the only way. The key is for the sum of the two above numbers to be constant and end in a 4 byte boundary.

  • The p_app_ram_base parameter is an in/out parameter. It will be updated with a value equal to the RAM reserved by the SoftDevice, for the given configuration. You only need to run this once, put a debugger/print after the enable call, then update the amount of RAM. When the new SDK hits, there should be some numbers for the most common configurations, but this is the way to find them yourself :)

Related