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

  • Hi

    Can you also provide the log from the peripheral side so we can take a look there as well. Have you added the service in the peripheral project as well? It just seems like the application requests a discovery with "Starting discovery of service with UUID 0x498B" , and then don't find the service UUID. Another thing that might be helpful is if you could take a sniffer trace of the connection so we can see what exactly is happening on the air. You can use a dedicated Bluetooth sniffer, like the Ellisys devices, or a spare nRF52 DK/Dongle if you have one and the nRF Sniffer running on Wireshark.

    Best regards,

    Simon

  • Hi Simon

    Thanks for the answer, i logged both sides to see whats happening.

    USB Dongle:

    I added the Characteristc UUID as well on the discovery List, with no further success(as expected).

    <info> app_timer: RTC: initialized.
    <info> app: USBD BLE UART example started.
    <debug> nrf_sdh_ble: RAM starts at 0x20002AE8
    <debug> nrf_sdh_ble: RAM start location can be adjusted to 0x20002A48.
    <debug> nrf_sdh_ble: RAM size for application can be adjusted to 0x3D5B8.
    <info> app: Initializing Nordic UART Service Client.
    <debug> ble_scan: Added filter on UUID 498B
    <debug> ble_scan: Scanning
    <debug> nrf_sdh_ble: BLE event: 0x1D.
    <debug> nrf_sdh_ble: BLE event: 0x1D.
    <debug> nrf_sdh_ble: BLE event: 0x1D.
    <debug> nrf_sdh_ble: BLE event: 0x1D.
    <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 6314D2F8FDCC
    <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.

    Server:

    <t:          0>, main.c,  691, ----- Control -----
    <t:      11921>, main.c,  567, Initializing and adding models
    <t:      11924>, main.c,  365, App Client Model handle: 2 
    <t:      11928>, main.c,  371, App Level Model handle: 3
    <t:      11931>, main.c,  377, App DTT Model handle: 4
    <t:      11935>, main.c,  384, App Scene Model handle: 6, Element index: 0
    <t:      11953>, main.c,  733, Loaded flash Parameters 
    <t:      17182>, mesh_app_utils.c,   66, Device UUID (raw): 407843200FBC4045A314D2F8FD8CAD20
    <t:      17185>, mesh_app_utils.c,   67, Device UUID : 40784320-0FBC-4045-A314-D2F8FD8CAD20
    <t:      17204>, main.c,  771, 
    		-------------------------------------------------------------
    		 RTT 1) Set the Signal on T1 equal for Testig purpose        
    		 RTT 2) Set the Signal on T2 equal for Testig purpose        
    		 RTT 3) Send Mesh Telegram from this Node ID          
    		 RTT 4) Clear all the states to reset the node.              
    		-------------------------------------------------------------
    <t:      17289>, app_level.c,  295, SET: Level: 0  delay: 0  tt: 0  req-delta: 0  trans-type: 0
    <t:      17294>, main.c,  293, command: 0 
    <t:      17296>, main.c,  338, Transition time: 0, Target level: 0, Transition type: 0
    <t:     596545>, mesh_gatt.c,  834, GATT connencted UNprovisioned 
    <t:     596550>, mesh_gatt.c,  616, New MTU: 66
    <t:     608340>, ble_softdevice_support.c,  104, Successfully updated connection parameters

    Server when Connected with Mobilephone and Serial APP Send "123456BEEF":

    <t:          0>, main.c,  691, ----- Control -----
    <t:      11165>, main.c,  567, Initializing and adding models
    <t:      11168>, main.c,  365, App Client Model handle: 2 
    <t:      11171>, main.c,  371, App Level Model handle: 3
    <t:      11175>, main.c,  377, App DTT Model handle: 4
    <t:      11179>, main.c,  384, App Scene Model handle: 6, Element index: 0
    <t:      11197>, main.c,  733, Loaded flash Parameters 
    <t:      16419>, mesh_app_utils.c,   66, Device UUID (raw): 407843200FBC4045A314D2F8FD8CAD20
    <t:      16422>, mesh_app_utils.c,   67, Device UUID : 40784320-0FBC-4045-A314-D2F8FD8CAD20
    <t:      16439>, main.c,  771, 
    		-------------------------------------------------------------
    		 RTT 1) Set the Signal on T1 equal for Testig purpose        
    		 RTT 2) Set the Signal on T2 equal for Testig purpose        
    		 RTT 3) Send Mesh Telegram from this Node ID          
    		 RTT 4) Clear all the states to reset the node.              
    		-------------------------------------------------------------
    <t:      16826>, app_level.c,  295, SET: Level: 0  delay: 0  tt: 0  req-delta: 0  trans-type: 0
    <t:      16831>, main.c,  293, command: 0 
    <t:      16833>, main.c,  338, Transition time: 0, Target level: 0, Transition type: 0
    <t:    3899567>, mesh_gatt.c,  834, GATT connencted UNprovisioned 
    <t:    3924723>, ble_softdevice_support.c,  104, Successfully updated connection parameters
    <t:    3990664>, ble_softdevice_support.c,  104, Successfully updated connection parameters
    <t:    4029167>, mesh_gatt.c,  839, GATT disonnencted UNprovisioned 
    <t:    4431815>, mesh_gatt.c,  834, GATT connencted UNprovisioned 
    <t:    4459813>, ble_softdevice_support.c,  104, Successfully updated connection parameters
    <t:    4526616>, ble_softdevice_support.c,  104, Successfully updated connection parameters
    <t:    5083484>, mesh_gatt.c,  616, New MTU: 66
    <t:    5107820>, mesh_gatt.c,  867, GATT write UNprovisioned 
    <t:    5789036>, mesh_gatt.c,  867, GATT write UNprovisioned 
    <t:    5789043>, mesh_gatt.c,  484, Received Data (raw): 123456BEEF
    <t:    5789046>, mesh_gatt.c,  495, Reply Data    (raw): F4ED03200000D300

    I used also the nRF Sniffer running wireshark but there is not realy something to see in both cases Mobile-Server or Dongle to server just advertising, last Message is Connect_IND in both cases. then silence till disconnect.

    What happend after "connected" would be Interesting.

    Kind regards

    Simon

  • 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

  • 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

Related