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

NRF_ERROR_NO_MEM in sd_ble_gatts_characteristic_add

Hi,

I get NRF_ERROR_NO_MEM calling sd_ble_gatts_characteristic_add when using more than 15 uuids. Can you help mitigating this?

Thanks,

Daniel

Parents Reply Children
  • Hi Daniel, 

    If you use S140, you can refer to S140 SoftDevice

    NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE indicates the set amount of memory dedicated to the attribute table (including the characteristic size) in the Softdevice, so this will also vary from project to project. If you exceed the size of it you will receive an NRF_ERROR_NO_MEM error. Modifying the NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE usually means you also need to reconfigure the RAM settings.

    For the RAM_START and the RAM_SIZE, there is no need for an equation or optimal values, as the SoftDevice will tell you if you have allocated too little RAM. You can start a debug session with the RTT logging enable if there is insufficient RAM allocated for the SoftDevice the logs will print a warning with the suggested RAM start address. See bjornspockeli's comment here to find out how to output the log information.

    For log information, you could go to sdk_config.h and enable NRF_LOG_ENABLED and NRF_LOG_BACKEND_RTT_ENABLED. Changing NRF_LOG_DEFAULT_LEVEL to 4 could show the "debug" log. 

    -Amanda H.

  • Amenda,

    The logging mechanism in the example you linked to is not of Softdevice. I reiterate my very simple question: What is the relationship (formula) between the number of characteristics and NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE? (I would be happy to get answers also on my other two questions but this is the most important one right now). I don't have the source code for the Softdevice and, therefore, cannot figure out robustly myself.

    Daniel

  • Hi Daniel, 

    I am afraid that there is no way to calculate the attribute size for a given number of services and characteristics( the internal build-up of the attribute table is "hidden" in the SoftDevice, which is not public information). Please see my colleague explained in this post

    -Amanda H.

  • Amenda,

    The post just restates the problem - the information is not public. Why not making it public?

    Daniel

  • It'd be great if Nordic could reveal a formula for calculating the NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE, or at the very least, a configurable log level for the SDH functions to output how they are allocating structures within it (similar perhaps to how the heap memory allocator logs). My particular application has large buffer sizes for its value characteristics (necessarily so), and so these values ended up needing to extend NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE quite significantly.

Related