Which SDK version are you using, is it SDK v12.x.x? Which function returns NRF_ERROR_NO_MEM? Is it sd_ble_gatts_service_add() or sd_ble_gatts_characteristic_add()?

If it is one of those two functions then you need to increase the size of the GATT table by setting the .attr_tab_size field of ble_enable_params.gatts_enable_params in ble_stack_init(), e.g.

ble_enable_params.gatts_enable_params.attr_tab_size = 0x1000;

Otherwise if will be set equal to SOFTDEVICE_GATTS_ATTR_TAB_SIZE == BLE_GATTS_ATTR_TAB_SIZE_DEFAULT == 0x000 which causes the SoftDevice to use the default GATT table size which is 0x580 bytes for S130 v2.x.x.

即修改GATT属性列表大小:

NORDIC 出现NRF_ERROR_NO_MEM错误与GATT属性表大小调整

 

调试GATT属性表大小:

1、先预留足够的RAM空间给蓝牙协议栈,如果是MDK,即调整RAM1的起始地址。

2、调整NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE大小,直到nrf_sdh_ble_enable返回ok

3、在services_init中添加所有服务与对应服务的特征,直到所有服务与特征添加成功,如果返回失败则继续回到步骤2加大NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE大小

4、查看nrf_sdh_ble_enable返回的RAM大小,然后调整MDK RAM1起始地址大小大于nrf_sdh_ble_enable返回的RAM大小

 

相关文章:

  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-08-01
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2021-09-14
  • 2021-06-23
  • 2021-08-30
  • 2022-12-23
  • 2021-08-13
相关资源
相似解决方案