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
  • As long as the app_ram_base address is lower than the ram_start address you should be good. So then it must be crashing after you enable the stack, does sd_ble_gatts_characteristic_add() return any error code now?

    If you do no know where the error code is coming from then set a breakpoint in app_error_handler_bare() and take a look at the call stack to see which function that generated the error.

Reply
  • As long as the app_ram_base address is lower than the ram_start address you should be good. So then it must be crashing after you enable the stack, does sd_ble_gatts_characteristic_add() return any error code now?

    If you do no know where the error code is coming from then set a breakpoint in app_error_handler_bare() and take a look at the call stack to see which function that generated the error.

Children
No Data
Related