Use Dongle as Client

Hi Nordic Team

I tried to get the USB Dongle PCA10049 to connect on a other device (PCA10056) over custom UUID and Custom characteristics.

I used the Example from Dev Zone Case ID 284737 as starting point.

With the serial app (Serial Bluetooth Terminal 1.40) i can connect and write on the server(PCA10056)

What i changed:

- Added the 2 vendor specific UUIDS 128bit.

- changed the Service and Characteristic UUID 0001 -> 0x498B and 0002 -> CFBB  corresponding to the UUIDS.

- changed debug level on debug 4 for more output.

What i need

Connecting to a 128bit UUID Service - done

Write/ Indicate(read) on one specific Characterisic with second 128bit UUID

Where i get stuck

the Example is searching, and connecting to the server device. but then prints primary service "UUID 498B found", then later on "not found".

When connected on the Serial Port of the dongle, i can see the Serial commands coming in, get in the queue and then sended on /cr command.

Log Print without Bootup

<debug> nrf_sdh_ble: BLE event: 0x1D.
<debug> nrf_sdh_ble: BLE event: 0x1D.
<debug> ble_scan: Connecting
<debug> ble_scan: Connection status: 0
<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<info> app: Connecting to target F873CD9D33C7
<debug> nrf_ble_gq: Registering connection handle: 0x0000
<debug> ble_db_disc: Starting discovery of service with UUID 0x498B on connection handle 0x0.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Primary Services Discovery Request
<debug> nrf_ble_gq: SD is currently busy. The GATT request procedure will be attempted                       again later.
<debug> nrf_ble_gq: Processing the request queue...
<debug> nrf_ble_gq: GATTC Primary Service Discovery Request
<debug> nrf_ble_gq: SD is currently busy. The GATT request procedure will be attempted                           again later.
<debug> nrf_sdh_ble: BLE event: 0x3A.
<debug> nrf_ble_gatt: ATT MTU updated to 69 bytes on connection 0x0 (response).
<info> app: ATT MTU exchange completed.
<info> app: Ble NUS max data length set to 0x42(66)
<debug> nrf_ble_gq: Processing the request queue...
<debug> nrf_ble_gq: GATTC Primary Service Discovery Request
<debug> nrf_ble_gq: SD GATT procedure (2) succeeded on connection handle: 0.
<debug> nrf_sdh_ble: BLE event: 0x24.
<debug> nrf_ble_gatt: Data length updated to 73 on connection 0x0.
<debug> nrf_ble_gatt: max_rx_octets: 73
<debug> nrf_ble_gatt: max_tx_octets: 73
<debug> nrf_ble_gatt: max_rx_time: 2120
<debug> nrf_ble_gatt: max_tx_time: 2120
<debug> nrf_sdh_ble: BLE event: 0x30.
<debug> ble_db_disc: Service UUID 0x498B not found.
<debug> ble_db_disc: Starting discovery of service with UUID 0xCFBB on connection handle 0x0.
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Primary Services Discovery Request
<debug> nrf_ble_gq: SD GATT procedure (2) succeeded on connection handle: 0.
<debug> nrf_ble_gq: Processing the request queue...
<debug> nrf_sdh_ble: BLE event: 0x1F.
<debug> nrf_sdh_ble: BLE event: 0x30.
<debug> ble_db_disc: Service UUID 0xCFBB not found.
<debug> nrf_ble_gq: Processing the request queue...
<debug> nrf_sdh_ble: BLE event: 0x12.
<info> app: CDC ACM port opened
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: 5
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: 0
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: 1
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: 1
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: a
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: RX: size: 1 char: c
<info> app: CDC_ACM_USER_EVT_RX_DONE
<debug> app: Ready to send data over BLE NUS
<debug> app:  35 30 31 31 61 63 0D   |5011ac. 
<debug> nrf_ble_gq: Adding item to the request queue
<debug> nrf_ble_gq: GATTC Write Request
<debug> nrf_ble_gq: SD GATT procedure (1) succeeded on connection handle: 0.
<debug> app: RX: size: 1 char: <debug> nrf_sdh_ble: BLE event: 0x3C.
<debug> nrf_ble_gq: Processing the request queue...

Kind Regards

Simon

Parents
  • Hi

    What firmware is running on the server side (nRF52840 DK) here? There seem to be some mentions to Bluetooth Mesh here, which a "regular" BLE application (like the CDC_ACM example project) won't be able to communicate properly with without having some Mesh firmware as well. A phone usually has a stack for both BLE and Bluetooth Mesh by default which would explain why it's able to communicate with it as expected. Is the service you're trying to discover a Mesh service by any chance?

    Best regards,

    Simon

Reply
  • Hi

    What firmware is running on the server side (nRF52840 DK) here? There seem to be some mentions to Bluetooth Mesh here, which a "regular" BLE application (like the CDC_ACM example project) won't be able to communicate properly with without having some Mesh firmware as well. A phone usually has a stack for both BLE and Bluetooth Mesh by default which would explain why it's able to communicate with it as expected. Is the service you're trying to discover a Mesh service by any chance?

    Best regards,

    Simon

Children
  • Hi

    The firmware running on the Server Side is based on the nrf Mesh Dimming server(Softdevice 140), the Gatt Modells are modified to have the Custom UUID and Services. Softdevice 140

    The service i try to discover is a plain GATT service, write, notify.

    Snipping of the NRF Connect for Desktop

    I will have a look on the CDC_ACM example.

    Regards

    Simon

  • Hi Simon

    The CDC-ACM helped me not a lot, this side is Working as expected. I did some Testing with the Plain BLE-UART server and could make it running till the point where i change the UUID from the Characteristic. As log it is the same as the Base UUID it works.

    Question:

    I had to discover the Characteristic UUID as well right?

    Do i have to add the second UUID to the scan response telegram as well?

    Can you give me a hint where to add the second vs_uuid to discover, sd_ble_uuid_vs_add() is called aftre the base UUID,  uuid_type is 0x03. Base UUID is 0x02

    Regards

    Simon

  • Hi Simon

    I had sucess.

    I had to discover the Characteristic UUID as well right?-> Will be found and adressed automaticly by the discovery module

    Do i have to add the second UUID to the scan response telegram as well? Not needed Service UUID is sufficent.

    ble_nus_c.c

    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_uuid_t    char_uuid;
        ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;//UUID for Service
        ble_uuid128_t second_char_uuid = CHAR_UUID; // UUID for Character
       
    
        VERIFY_PARAM_NOT_NULL(p_ble_nus_c);
        VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init);
        VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init->p_gatt_queue);
    
        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->error_handler         = p_ble_nus_c_init->error_handler;
        p_ble_nus_c->handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
        p_ble_nus_c->handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
        p_ble_nus_c->p_gatt_queue          = p_ble_nus_c_init->p_gatt_queue;
    
        uint8_t type; 
        err_code = sd_ble_uuid_vs_add(&second_char_uuid, &type); // char UUID add
        VERIFY_SUCCESS(err_code);
    
        char_uuid.type = type;
        char_uuid.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC;
    
       // ble_db_discovery_evt_register(&char_uuid); // Do not add for dicovery only Services
    
        return ble_db_discovery_evt_register(&uart_uuid);

    Kind regards

    Simon

Related