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

Increasing the size of attribute table

Hi, 

I'm using SDK v15.3.0 which has s132 6.1.1 to program an nRF521832. I had a single custom service on my stack and that was working well. I added a second service and I got ERROR 4 [NRF_ERROR_NO_MEM]. I understand that this is caused by the attribute table size not being large enough. so I increased it from the default - BLE_GATTS_ATTR_TAB_SIZE_DEFAULT = 1408 - to 3000 - approximately more than the double as a starting point. This is definitely an overkill as my second custom service has less characteristics than the first. This is what I did to increase the size of the attribute table - line 18 was added:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void ble_stack_init(void)
{
ret_code_t err_code;
err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code);
// Configure the BLE stack using the default settings.
// Fetch the start address of the application RAM.
uint32_t ram_start = 0;
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
APP_ERROR_CHECK(err_code);
ble_cfg_t ble_cfg;
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 13;
ble_cfg.gatts_cfg.attr_tab_size.attr_tab_size = 3000;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I learned that I also have to increase both RAM_START and RAM_SIZE - according to this thread

Those are the linker macros I had defined before increasing them, and they were working fine for a single service:

Fullscreen
1
2
3
4
5
6
7
8
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x80000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x10000
FLASH_START=0x26000
FLASH_SIZE=0x5a000
RAM_START=0x20002b90
RAM_SIZE=0xd470
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


And this is after I added 1600 to RAM_START and RAM_SIZE:
Fullscreen
1
2
3
4
5
6
7
8
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x80000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x10000
FLASH_START=0x26000
FLASH_SIZE=0x5a000
RAM_START=0x200031D0
RAM_SIZE=0xdab0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I'm not sure what else I'm missing, but I still get the same error. 

One other interesting thing I'm getting is that if I set ble_cfg.gatts_cfg.attr_tab_size.attr_tab_size = 2816, I get Error 7 (invalid parameter). I can only seem to be able to use values that are multiples of 100. Is it meant to be this way?

Thanks
 

Parents
  • I Fixed the problem by changing NRF_SDH_BLE_VS_UUID_COUNT to 2. 

    Now I'm getting ERROR 12 upon calling ble_advertising_init. I understand that this is caused by exceeding the advertising packet max payload of 31 bytes. What options do I have to solve this? Is there a way to increase it?
    Please note that I don't need to be transmitting all services and characteristics at the same time, so maybe I could activate and deactivate services/characteristics accordingly. 

  • Hi

    Can you please create a new ticket on this, as we strive to keep each ticket to one specific subject here on DevZone.

    Best regards,

    Simon

Reply Children
No Data