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

sd_ble_enable return error 18

Hi

I use SDK version 12.2.0 to do a project. I add two 128bit uuid into my project. The one of 128bit uuid is created by myself. The other one of 128bit uuid is used ancs by SDK 12.2.0. I have a problem to get information that error code (0x18) when I call sd_ble_enable.

I tried some test for this condition. I removed ancs service(only use my created service). I set parameter as below and it works.

memset(p_ble_enable_params, 0, sizeof(ble_enable_params_t));
p_ble_enable_params->common_enable_params.vs_uuid_count   = 1;
p_ble_enable_params->gatts_enable_params.attr_tab_size    = SOFTDEVICE_GATTS_ATTR_TAB_SIZE;
p_ble_enable_params->gatts_enable_params.service_changed  = SOFTDEVICE_GATTS_SRV_CHANGED;
p_ble_enable_params->gap_enable_params.periph_conn_count  = 1;
p_ble_enable_params->gap_enable_params.central_conn_count = 0;

On the other hand, I tried to remove a service that create by myself(only use ancs service). I use parameter as below, it also works.

memset(p_ble_enable_params, 0, sizeof(ble_enable_params_t));
p_ble_enable_params->common_enable_params.vs_uuid_count   = 10;
p_ble_enable_params->gatts_enable_params.attr_tab_size    = SOFTDEVICE_GATTS_ATTR_TAB_SIZE;
p_ble_enable_params->gatts_enable_params.service_changed  = SOFTDEVICE_GATTS_SRV_CHANGED;
p_ble_enable_params->gap_enable_params.periph_conn_count  = 1;
p_ble_enable_params->gap_enable_params.central_conn_count = 0;

I merged both of service into a project. I used parameter as below. It has failure of sd_ble_enable err_code (0x12).

memset(p_ble_enable_params, 0, sizeof(ble_enable_params_t));
p_ble_enable_params->common_enable_params.vs_uuid_count   = 11;
p_ble_enable_params->gatts_enable_params.attr_tab_size    = SOFTDEVICE_GATTS_ATTR_TAB_SIZE;
p_ble_enable_params->gatts_enable_params.service_changed  = SOFTDEVICE_GATTS_SRV_CHANGED;
p_ble_enable_params->gap_enable_params.periph_conn_count  = 2;
p_ble_enable_params->gap_enable_params.central_conn_count = 0;

I have no idea. Could you help me to solve this problem? Or tell me what I can do. Thanks.

This is my log for three conditions.

Only add BLE_ANCS_C LOG:

[APP_BUTTON]:INFO:app_button_enable ++++
[APP_BUTTON]:INFO:pin_no = 17
[APP_BUTTON]:INFO:pin_no = 18
[APP_BUTTON]:INFO:pin_no = 19
[APP_BUTTON]:INFO:pin_no = 20
CLOCK:INFO:Function: nrf_drv_clock_init, error code: NRF_SUCCESS.
SDH:INFO:[JOHNLIN][softdevice_enable]: vs_uuid_count = 1, service_changed = 0, periph_conn_count = 1, central_links_count = 0
APP:INFO:[ble_stack_init]: vs_uuid_count = 10, service_changed = 0, periph_conn_count = 1, central_links_count = 0
SDH:INFO:[softdevice_enable]: RAM start at 0x20002078
SDH:INFO:[softdevice_enable]: err_code = 0
SDH:INFO:[softdevice_enable]: vs_uuid_count = 10, service_changed = 0, periph_conn_count = 1, central_links_count = 0
APP:INFO:[softdevice_ble_evt_handler_set]: err_code = 0
APP:INFO:[softdevice_sys_evt_handler_set]: err_code = 0
UFIT_SERVICE:INFO:[db_discovery_init] err_code = 0
UFIT_SERVICE:INFO:[ancs_init] err_code = 0
APP:INFO:BLE ANCS Started
UFIT_SERVICE:INFO:Connected.
UFIT_SERVICE:INFO:Disconnected.

Only BLE_UFIT SERVICE LOG:

[APP_BUTTON]:INFO:app_button_enable ++++
[APP_BUTTON]:INFO:pin_no = 17
[APP_BUTTON]:INFO:pin_no = 18
[APP_BUTTON]:INFO:pin_no = 19
[APP_BUTTON]:INFO:pin_no = 20
CLOCK:INFO:Function: nrf_drv_clock_init, error code: NRF_SUCCESS.
SDH:INFO:[softdevice_enable]: vs_uuid_count = 1, service_changed = 0, periph_conn_count = 1, central_links_count = 0
APP:INFO:[ble_stack_init]: vs_uuid_count = 1, service_changed = 0, periph_conn_count = 1, central_links_count = 0
SDH:INFO:[softdevice_enable]: RAM start at 0x20002078
SDH:INFO:[softdevice_enable]: err_code = 0
SDH:INFO:[softdevice_enable]: vs_uuid_count = 1, service_changed = 0, periph_conn_count = 1, central_links_count = 0
SDH:WARNING:sd_ble_enable: RAM start should be adjusted to 0x20001fe8
SDH:WARNING:RAM size should be adjusted to 0x6018
APP:INFO:[softdevice_ble_evt_handler_set]: err_code = 0
APP:INFO:[softdevice_sys_evt_handler_set]: err_code = 0
UFIT_SERVICE:INFO:[db_discovery_init] err_code = 0
UFIT_SERVICE:INFO:[ufit_init] err_code = 0
APP:INFO:BLE ANCS Started

Both of UUID 128bit services LOG:

[APP_BUTTON]:INFO:app_button_enable ++++
[APP_BUTTON]:INFO:pin_no = 17
[APP_BUTTON]:INFO:pin_no = 18
[APP_BUTTON]:INFO:pin_no = 19
[APP_BUTTON]:INFO:pin_no = 20
CLOCK:INFO:Function: nrf_drv_clock_init, error code: NRF_SUCCESS.
SDH:INFO:[softdevice_enable]: vs_uuid_count = 1, service_changed = 0, periph_conn_count = 2, central_links_count = 0
APP:INFO:[ble_stack_init]: vs_uuid_count = 11, service_changed = 0, periph_conn_count = 2, central_links_count = 0
SDH:INFO:[softdevice_enable]: RAM start at 0x20002078
SDH:INFO:[softdevice_enable]: err_code = 18
SDH:INFO:[softdevice_enable]: vs_uuid_count = 11, service_changed = 0, periph_conn_count = 2, central_links_count = 0
SDH:ERROR:sd_ble_enable: error 0x12
APP_ERROR:ERROR:Fatal
Parents
  • Hi

    I put my log for three conditions. In the first and second case, it just only one custom UUID and it works very well. I know that usual problems with RAM memory region size. I had adjusted RAM start address and size when log changed start address and size. I will try both services that all from nRF5 SDK to double check this issue.

  • Ufff, you are mixing up silicon type (nRF51 on PCA10028 vs. nRF52832 on PCA10040 vs. nRF52840 on PCA10056) with GATT stack layer (UUIDs, Services) with higher BLE APP specs (ANCS) with even higher things like iPhone notifications. There is no answer to that;) I'm afraid to bridge all the gaps it would involve dozens of questions and answers which means days of ping pong here on the forum...

Reply
  • Ufff, you are mixing up silicon type (nRF51 on PCA10028 vs. nRF52832 on PCA10040 vs. nRF52840 on PCA10056) with GATT stack layer (UUIDs, Services) with higher BLE APP specs (ANCS) with even higher things like iPhone notifications. There is no answer to that;) I'm afraid to bridge all the gaps it would involve dozens of questions and answers which means days of ping pong here on the forum...

Children
No Data
Related