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

s132_nrf52_2.0.0-4.alpha sd_ble_enable

Hi, The function sd_ble_enable(ble_enable_params_t * p_ble_enable_params, uint32_t * p_app_ram_base) requires now the application RAM base address! Is it 0x20002800?

  • Hi RG,

    From the version of softdevice you mentioned. The RAM usage by softdevice has changed.

    1. SoftDevice(SD) needs fixed amount of RAM memory that is fully dedicated for it.

    2. SD also needs RAM memory per connection (central and/or peripheral).

    3. SD also needs RAM memory for SMP per link.

    4. SD also needs RAM memory for attribute table size.

    5. is fixed and cannot be changed, but the amount of ram SD needs for 2,3 and 4 is variable on the application use case.

    So efforts have been taken that it does not reserve more RAM than it needs and this is dependent on how many links you need on your device (all details are passed in p_ble_enable_params argument in sd_ble_enable call).

    So if you gave the value for p_app_ram_base too less and this value overlaps with softdevice RAM space for the given configuration in p_ble_enable_params, then this call would return an error and writes the pointer p_app_ram_base with value where it expects the app RAM base needs to be started for the configuration given.

    So, if you do not know what value to set in p_app_ram_base, then make the pointer to point to small value or zero and the sd_ble_enable would fail with error NRF_ERROR_DATA_SIZE and the argument pointer will be updated with value what it should be set to.

  • Hi Aryan,

    If my application is a BLE peripheral, the ble_enable_params.gap_enable_params.periph_conn_count is set to 1, is that right?

  • yes, you are right and set p_ble_enable_params.gap_enable_params.central_conn_count to 0

  • Thanks for the info Aryan. It really helped me getting the SoftDevice running. I was wondering what this new parameter would be and just made it point to the APP_RAM_BASE location itself 0x20002800. Of course this would not work because this is the vector table start address (initial stack pointer) Playing around with the configuration, I think I have found a major bug: If i set all enable parameters to 0, I get a DEADBEEF error at line 1137 stack/libs/host/src/host_core.c If I set periph, central and uui to 1, initialization finishes successfully. We sometimes want to use the system in broadcaster or observer mode without any connections, in this case all enable parameters should be 0 (if I'm not missing anything specific)

    By the way, in the older versions, setting attr_tab_size to 0 made the system use the default value of 0x600. How is it handled in the S132v2 implementation?

  • For observer you still need to set central_conn_count to 1 and for broadcaster you still need periph_conn_count to 1. It is an an error to set everything to 0, but it should have returned an error instead of asserting in the softdevice. I will verify this and create a internal ticket if that is true.

Related