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

Out of memory when enabling notifications

I am working on a project based on the ble_app_hrs_rscs_relay example project which I have largely extended with many additional services.

For example I am offering an additional custom service with 128 Bit UUIDs, several 16-bit UUID services, etc. For the HRS and CSCS client-connections I have also added the discovery of the DIS and the BAS service to print those information when connecting.

For the 128 bit UUID service I had already to increase the memory for the softdevice in the linker options. However, now that I've added the notification on the BAS client service I get another error "ERROR 4 [NRF_ERROR_NO_MEM] at D:\nRF5_SDK_17.0.2_d674dde\......." when calling a "enable notification" routine for the CSCS_C service (err_code = ble_cscs_c_csc_notif_enable(p_cscs_c));

I am wondering what part of the reserved RAM is running out of ressources here?

I found that the GATTs attribute table size might be too small due to the many services and characteristics I have added and increased it to 1800 from the default 1408 in the sdk_config.h

#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1800//  1408

However this did not remedy the problem.

The problem went away when I was disabling notification on the BAS service. Only then the notification enablement on the CSCS_C service was successful again.

Which parameter do I have to tweak to be able to enable notifications on all those services at once? Which parameter in the sdk_config.h is it?

Parents
  • Hi,

    The ble_cscs_c_csc_notif_enable() function would call cccd_configure(), but you should not normally get NRF_ERROR_NO_MEM when calling cccd_configure() as the SoftDevice does not need to allocate more memory for this. if you see that, this means that nrf_ble_gq_item_add() returned NRF_ERROR_NO_MEM, which typically could happen if the GATT queue is too small. So, can you try to increase NRF_BLE_GQ_QUEUE_SIZE in your sdk_config.h?

Reply
  • Hi,

    The ble_cscs_c_csc_notif_enable() function would call cccd_configure(), but you should not normally get NRF_ERROR_NO_MEM when calling cccd_configure() as the SoftDevice does not need to allocate more memory for this. if you see that, this means that nrf_ble_gq_item_add() returned NRF_ERROR_NO_MEM, which typically could happen if the GATT queue is too small. So, can you try to increase NRF_BLE_GQ_QUEUE_SIZE in your sdk_config.h?

Children
No Data
Related