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

52832 center to discover 2 service UUID

use sdk:11.0

Reference routine:ble_nus_c

now I use 52832 to connect a device,the service UUID like the photo.

when I only discover one service UUID,like this code

uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init)
{
    uint32_t      err_code;
    ble_uuid_t    uart_uuid;
	
    ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;
    
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c);
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init);

    err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_ble_nus_c->uuid_type);
    VERIFY_SUCCESS(err_code);
    uart_uuid.type = p_ble_nus_c->uuid_type;
    uart_uuid.uuid = BLE_UUID_NUS_SERVICE;
	
    p_ble_nus_c->conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_nus_c->evt_handler           = p_ble_nus_c_init->evt_handler;
    p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
    
		err_code=ble_db_discovery_evt_register(&uart_uuid);
    return err_code;
}

the center can connect the device,and send some command to control the device.

but when I add some code,want to discover the second service UUID,the code like this

uint32_t ble_nus_c_init2(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init)
{
    uint32_t      err_code;
		ble_uuid_t    uart_uuid2;
	
    ble_uuid128_t nus_base_uuid2 = NUS_BASE_UUID2;   
    
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c);
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init);
    
		err_code = sd_ble_uuid_vs_add(&nus_base_uuid2, &p_ble_nus_c->uuid_type);
    VERIFY_SUCCESS(err_code);
		uart_uuid2.type = p_ble_nus_c->uuid_type;
    uart_uuid2.uuid = BLE_UUID_NUS_SERVICE2;
	
    p_ble_nus_c->conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_nus_c->evt_handler           = p_ble_nus_c_init->evt_handler;
    p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
    
		err_code = ble_db_discovery_evt_register(&uart_uuid2);
    return err_code;
}

when the center  to discover the second UUID,it  always restart。

So  how to reconige 2 service UUID

Parents
  • Hi,

    Please read this tutorial on how to catch errors and assert, to find the actual file name, line number and error code that caused it. https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-error-handling-in-nrf5-projects 

    By default the error handler is setup to reset the chip to safely recover, and this make sense for an end-product, however during development it is more useful to define DEBUG to catch such errors so you fix them. In your case the problem may be that you have not initialized the softdevice to support more than 1 vendor specific UUID, e.g.:

    p_ble_enable_params->common_enable_params.vs_uuid_count = ??

    Also, is there any particular reason why you are working on an old SDK such as v11? The latest is nRF5 SDK v16. You should be aware that the system_nrf52.c file in SDK v11 is missing workaround for errata_108(), so this file should at least be updated from SDK v16 if you intend to continue work with SDK v11.

    Kenneth

Reply
  • Hi,

    Please read this tutorial on how to catch errors and assert, to find the actual file name, line number and error code that caused it. https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-error-handling-in-nrf5-projects 

    By default the error handler is setup to reset the chip to safely recover, and this make sense for an end-product, however during development it is more useful to define DEBUG to catch such errors so you fix them. In your case the problem may be that you have not initialized the softdevice to support more than 1 vendor specific UUID, e.g.:

    p_ble_enable_params->common_enable_params.vs_uuid_count = ??

    Also, is there any particular reason why you are working on an old SDK such as v11? The latest is nRF5 SDK v16. You should be aware that the system_nrf52.c file in SDK v11 is missing workaround for errata_108(), so this file should at least be updated from SDK v16 if you intend to continue work with SDK v11.

    Kenneth

Children
No Data
Related