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

CUSTOM UUID and MEMORY SETTING

Hello. 
I want to build two services with custom UUIDs. I have successfuly built first one using this guide. Then I try to build second one, using the same guide, but I meet unknown problem in services_init() function. The problem occure in this place: services_init(); -> ble_sps_init ->

    err_code =  sd_ble_uuid_vs_add(&base_uuid, &p_sds->uuid_type);
    VERIFY_SUCCESS(err_code);

I don't know what this problem  come from. I suggested that problem with memory settings. I change those values in project options from this:
RAM_START=0x20002220
RAM_SIZE=0xdde0

to this:

RAM_START=0x20002228
RAM_SIZE=0xddd8

But this is not help. I also try to use the same UUID as for first, successfully working service, but then I meet another trouble, when I try to handle it, i get wrong values of pointer to handle attribute "p_evt_write->handle" in ble_sps_on_ble_evt(). So I think it happend because I use the same UUID. 

So what how can I solve problem with using different UUIDs? And why I can get wrong pointer to handle attribute in event handler?

My application is based on ble_app_template. I use nrf52-DK, s132 6.1.0, SDK 15.1

Parents
  • Sorry guys, I find my mistake I make wrong global variable declaration m_sps.
    Anyway, will be very good if nordic guys will  specify how to calculate optimal values of NRF_SDH_BLE_VS_UUID_COUNT, NRF_SDH_BLE_VS_UUID_COUNT, NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE and optimal numbers of RAM_START and RAM_SIZE

  • Hi,

    The NRF_SDH_BLE_VS_UUID_COUNT macro defines the number of vendor-specific UUIDs, so just increase this count with +1 everytime you add a new vendor-specific UUID.

    NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE indicates the set amount of memory dedicatde for the attribute table (including the characteristic size) in the Softdevice, so this will also vary from project to project. If you exceed the size of it you will receive a NRF_ERROR_NO_MEM error. Modifying the NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE usually means you also need to reconfigure the RAM settings.

    For the RAM_START and the RAM_SIZE, there is no need for an equation or optimal values, as the SoftDevice will actually tell you if you have allocated too little RAM. You can start a debug session with the RTT logging enable, if there is insuficcient RAM allocated for the SoftDevice the logs will print a warning with the suggested RAM start adress. See bjornspockeli comment here to find out how to output the log information.

    Best Regards,

    Marjeris

  • Thanks for the answer.

    To get Softdevice message about optimal value of the RAM_START and RAM_SIZE I should use app_error_fault_handler() provided by SDK, is it correct?

    It's not comfortable in case, if you provide own handler. 

  • Hi,

    You need to go to sdk_config.h and enable NRF_LOG_ENABLED and NRF_LOG_BACKEND_RTT_ENABLED, and set the log level to "debug" by changing NRF_LOG_DEFAULT_LEVEL to 4.

    Best Regards,

    Marjeris

Reply Children
No Data
Related