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 guys! @vincent: I was successful to add only one more service. The problem appears when I tried to add two. But, I forgot to say that this services are custom services. This is the reason why I had to add "ble_enable_params.common_enable_params.vs_uuid_count =4", but You did not.

    Actually, the two servicis that I want to add are: ble_tcs and ble_tms from thingy project. Again, if I add only one of this services all works ok, but if I enable both at the same time as NUS, I get hardfault.

    Thanks for your code any way!

    @Bjørn Spockeli, I tried incrementing ram, as I saw in other questions, but it did'nt resolve the problem. I'm using the "debug" label in the compiler options. If I set ble_enable_params.gatts_enable_params.attr_tab_size = 5000; then I get error 4. Could you sayme what is the maxium ram config?

Reply
  • Hi guys! @vincent: I was successful to add only one more service. The problem appears when I tried to add two. But, I forgot to say that this services are custom services. This is the reason why I had to add "ble_enable_params.common_enable_params.vs_uuid_count =4", but You did not.

    Actually, the two servicis that I want to add are: ble_tcs and ble_tms from thingy project. Again, if I add only one of this services all works ok, but if I enable both at the same time as NUS, I get hardfault.

    Thanks for your code any way!

    @Bjørn Spockeli, I tried incrementing ram, as I saw in other questions, but it did'nt resolve the problem. I'm using the "debug" label in the compiler options. If I set ble_enable_params.gatts_enable_params.attr_tab_size = 5000; then I get error 4. Could you sayme what is the maxium ram config?

Children
No Data
Related