Hello everyone, i have get nRF52840-PDK and now working on it. I use SDK 13 and SoftDevice S140. My Project base on ble_app_template and i want add my service in this Project.
I follow this Tutorial BLE Services, a beginner's tutorial
First declare a service structure
typedef struct BLEMyServiceTag
{
uint16_t conn_handle;
uint16_t service_handle;
ble_gatts_char_handles_t char_handle;} BLEMyService;
BLEMyService BMA250E_service;
in the function services_init() in main.c initialize the service
BMA250E_service_init(&BMA250E_service);
Following code are the function BMA250E_service_init(),
void BMA250E_service_init(BLEMyService *p_service)
{
uint32_t err_code1;
ble_uuid_t service_uuid;
ble_uuid128_t base_uuid = BLE_UUID_BIL_BASE_UUID;
service_uuid.uuid = BLE_UUID_OUR_SERVICE;
err_code1 = sd_ble_uuid_vs_add(&base_uuid,&service_uuid.type);
APP_ERROR_CHECK(err_code1);
err_code1 = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,&service_uuid,&p_service->service_handle);
APP_ERROR_CHECK(err_code1);}
Compile, download code to nRF52840-PDK, but it doesn't work. The board can't advertising. I test my code in nRF51 DK and it works.
Where did i wrong? Can anyone help me?
/******************************Problem solved******************************************/
I am getting an error "No Memory for operation"(err code=4) when sd_ble_uuid_vs_add() is called. Reading the similar Questions in Nordic Dev Zone, i change the following code from ble_stack_init() in main.c.
default: ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 0;
changed: ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = BLE_UUID_VS_COUNT_DEFAULT;
and then I get the same error "No Memory for operation"(err code=4) when softdevice_enable() is called.
I changed the IRAM1 Start and Size and this problem solved.