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

No Memory for operation when use sd_ble_gatts_characteristic_add to add a characteristic with S140

Hi all,

I'm using nRF52840 and S140 based on the ble_app_uart example. I get a error code 4 when use sd_ble_gatts_characteristic_add to add a characteristic for another service. I didn't change any setting for the Keil and the softdevice_enable function didn't indicate anything to change the RAM setting.

If I set the MTU size to 20, not 158, it's ok. But we want to use Bluetooth 5. So could you tell me what should I do? Thanks.

Besides, s140 support 2M 1M 500k 150K data rate, could you tell me how to configure it to use the different data rate? Is there any example refer to?

After that, I can use sd_ble_gatts_hvx to send 158 bytes max length one time, right?

Parents
  • You don't increase the attribute table size by only increasing the amount of RAM reserved by the SoftDevice, you need to tell the SoftDevice what size you want the attribute table to be. Something like:

    ble_cfg_t ble_cfg;
    memset(&ble_cfg, 0x00, sizeof(ble_cfg));
    ble_cfg.gatts_cfg.attr_tab_size.attr_tab_size = 2000;
    err_code = sd_ble_cfg_set(BLE_GATTS_CFG_ATTR_TAB_SIZE, &ble_cfg, ram_start);
    APP_ERROR_CHECK(err_code);
    

    This is usually added in ble_stack_init(). If this doens't work, I think you will have to upload your complete project or tell us how to reproduce this error.

Reply
  • You don't increase the attribute table size by only increasing the amount of RAM reserved by the SoftDevice, you need to tell the SoftDevice what size you want the attribute table to be. Something like:

    ble_cfg_t ble_cfg;
    memset(&ble_cfg, 0x00, sizeof(ble_cfg));
    ble_cfg.gatts_cfg.attr_tab_size.attr_tab_size = 2000;
    err_code = sd_ble_cfg_set(BLE_GATTS_CFG_ATTR_TAB_SIZE, &ble_cfg, ram_start);
    APP_ERROR_CHECK(err_code);
    

    This is usually added in ble_stack_init(). If this doens't work, I think you will have to upload your complete project or tell us how to reproduce this error.

Children
Related