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

Problems to add more services next to NUS

Hi there,

In my SDK12- SD132 NRF52 app, I'm running NUS ok, and I want to add two more services. So, I made this changes at ble_stack init:

ble_enable_params.common_enable_params.vs_uuid_count =4;
ble_enable_params.gatts_enable_params.attr_tab_size = 2000;

In services_init function, I added boths new services initializers, same as on_ble_evt, with respective handlers.

All seems to be ok, but I get a hardfault at sd_ble_gatts_characteristic_add in the last service.

If I comment anyone of the three services (at services_init) the app works fine and I can see this services with the nrf connect app.

Its a memory issue, i'm sure. I tried incrementing even more attr_tab_size, but it doesn't help.

What am I missing?

Update:

Hi, Looking with more detail, I was wrong. The hard fault don't occur at sd_ble_gatts_characteristic_add, but two lines before. Here:

ttr_char_value.init_len = p_tcs_init->p_init_vals->dev_name.len;

Its a simple value assignation. The hardfault I get is:

HardFault next to last line

Where p_stack_address is 0x200046F0.

My RAM 1 setup is: 0x20004068 - 0xD380

So its seems to be a ram problem. But I don't know what to do... Help!

Parents
  • Hi, I did not adjust anything. I already show you everything in my code. And My Ram: Start : 0x20002128 Size: 0xDED8

    and first I got error in

    err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
    

    then I adjust here

    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    //advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
    

    that's all.

Reply
  • Hi, I did not adjust anything. I already show you everything in my code. And My Ram: Start : 0x20002128 Size: 0xDED8

    and first I got error in

    err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
    

    then I adjust here

    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    //advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
    

    that's all.

Children
No Data
Related