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

Nus service not shown up

With our custom board, I have implemented the battery service and it's working well. But the nus service is not shown up at all, the same initialization code as the official example happen in ble_bas_wrap.c and ble_nus_wrap.c as follows:

void ble_bas_wrap_init(void)
{
	ret_code_t     err_code;
	ble_bas_init_t bas_init;

  // Initialize Battery Service.
memset(&bas_init, 0, sizeof(bas_init));

// Here the sec level for the Battery Service can be changed/increased.
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);

bas_init.evt_handler          = NULL;
bas_init.support_notification = true;
bas_init.p_report_ref         = NULL;
bas_init.initial_batt_level   = 100;

err_code = ble_bas_init(&m_bas, &bas_init);
APP_ERROR_CHECK(err_code);
}

Nus:

void ble_nus_wrap_init(void) 
{
uint32_t       err_code;
ble_nus_init_t nus_init;

memset(&nus_init, 0, sizeof(nus_init));

nus_init.data_handler = nus_data_handler;

err_code = ble_nus_init(&m_nus, &nus_init);
APP_ERROR_CHECK(err_code);	
}

This two function are called in the service_init() of main function:

void services_init(void)
{	
    // Battery Service
    ble_bas_wrap_init();
    // UART Service
    ble_nus_wrap_init();
}

For m_adv_uuids, it is defined as:

static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
                                   {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE}};

In the nRF connection, after connecting to our device, only battery service shows up. Does anyone know what could be the reason?

Parents Reply Children
No Data
Related