Ble with Windows 10 - BLE_GAP_EVT_DISCONNECTED with reason 0x13

Hai, how you doing?

I am facing difficulty in trying to connect ble devices with windows 10. I am using BLE dongle APLIC WDP 304747 (Also tried another couple of BLE dongles).

I am using nrf52840 DK and Softdevice s140_nrf52_7.2.0. SDK version is 17.0.2

Initially a connection is successfully established between the windows and ble application. Then a disconnect event happens with a return code of 0x13. 

 

00> <debug> app: FDS event 0 with result 0.
00> 
00> <debug> nrf_ble_lesc: Initialized nrf_crypto.
00> 
00> <debug> nrf_ble_lesc: Initialized nrf_ble_lesc.
00> 
00> <debug> nrf_ble_lesc: Generating ECC key pair
00> 
00> <info> app: Erase bonds!
00> 
00> <info> peer_manager_handler: All peers deleted.
00> 
00> <info> app: Fast advertising.
00> 
00> <info> app: Application started
00> 
00> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
00> 
00> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
00> 
00> <info> app: Connected.
00> 
00> <debug> nrf_ble_gatt: Peer on connection 0x0 requested an ATT MTU of 527 bytes.
00> 
00> <debug> nrf_ble_gatt: Updating ATT MTU to 247 bytes (desired: 247) on connection 0x0.
00> 
00> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
00> 
00> <info> app: GATT ATT MTU on connection 0x0 changed to 247.
00> 
00> <debug> app: BLE_GAP_EVT_SEC_PARAMS_REQUEST
00> 
00> <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0.
00> 
00> <debug> nrf_ble_gatt: max_rx_octets: 251
00> 
00> <debug> nrf_ble_gatt: max_tx_octets: 251
00> 
00> <debug> nrf_ble_gatt: max_rx_time: 2120
00> 
00> <debug> nrf_ble_gatt: max_tx_time: 2120
00> 
00> <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
00> 
00> <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x0 bond=0x1 lv4: 0 kdist_own:0x1 kdist_peer:0x0
00> 
00> <debug> app: FDS event 1 with result 0.
00> 
00> <info> app: FDS write success.
00> 
00> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Bonding data, action: Update
00> 
00> <debug> app: FDS event 1 with result 0.
00> 
00> <info> app: FDS write success.
00> 
00> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update
00> 
00> <debug> app: FDS event 1 with result 0.
00> 
00> <info> app: FDS write success.
00> 
00> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
00> 
00> <debug> app: FDS event 1 with result 0.
00> 
00> <info> app: FDS write success.
00> 
00> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Central address resolution, action: Update
00> 
00> <debug> app: FDS event 2 with result 0.
00> 
00> <info> app: FDS update success.
00> 
00> <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
00> 
00> <info> app: Fast advertising.
00> 
00> <info> app: Disconnected, reason 19.

I noticed the issue with our custom application. Android and iOS doesnot have this issue. 

I then tried to flash the peripheral examples to the DK and obsereved the same behaviour. 

You can reproduce this at your end by flashing nordic blinky peripheral example on to nrf5 device (SDK 17 0 2 and s140_nrf52_7.2.0.). 

What could be the reason for this. I went through the forum and tried checking various pairing and bonding documentation. But if all the examples in the SDK has the same issue, then I think its better to report before digging deeper in it. Can you please try to reproduce it from your end and help me solve this issue?

Best regards,

Adarsh

Parents
  • Hi Adarsh

    Disconnect reason 0x13 indicates that the remote user terminated the connection (this is defined in ble_hci.h). It means that since you're seeing it on the peripheral side, the central (Windows 10 Dongle) side is trigging the disconnect for some reason. Are you able to see a disconnect reason on the Windows side, or are you able to take a Sniffer trace of what is happening over the air to give us a better idea? My guess is that your nRF52840 DK is requesting something the Dongle doesn't support, and thus the Dongle disconnects from it.

    This is where you download the nRF Sniffer. You should also check out the nRF sniffer user guide on our Infocenter to get started. 

    Best regards,

    Simon

Reply
  • Hi Adarsh

    Disconnect reason 0x13 indicates that the remote user terminated the connection (this is defined in ble_hci.h). It means that since you're seeing it on the peripheral side, the central (Windows 10 Dongle) side is trigging the disconnect for some reason. Are you able to see a disconnect reason on the Windows side, or are you able to take a Sniffer trace of what is happening over the air to give us a better idea? My guess is that your nRF52840 DK is requesting something the Dongle doesn't support, and thus the Dongle disconnects from it.

    This is where you download the nRF Sniffer. You should also check out the nRF sniffer user guide on our Infocenter to get started. 

    Best regards,

    Simon

Children
  • Hallo Simonr,

    Thanks for your time and suggestion.

    I will try and capture traces to better explain the picture. But, this happens with the generic microsoft bluetooth driver (When tried on a Laptop without dongle). And as already mentioned, it happens for most of the peripheral examples.

    Have you tried to reproduce this at your end? Meantime I will try to capture BLE traces using sniffer as you suggested.

    Best regards,

    Adarsh 

  • Hallo Simonr,

    I am attaching the sniffer trace below. I am having a hard time to understand what went wrong.  Can you help me here?

    conn with windows 10.pcapng

    Here are my connection parameters. 

    #define APP_ADV_DURATION                    0 // Advertise without any timeout
    #define MIN_CONN_INTERVAL                   MSEC_TO_UNITS(15, UNIT_1_25_MS) //15
    #define MAX_CONN_INTERVAL                   MSEC_TO_UNITS(30, UNIT_1_25_MS) //20
    #define SLAVE_LATENCY                       0
    #define CONN_SUP_TIMEOUT                    MSEC_TO_UNITS(1000, UNIT_10_MS)
    
    #define FIRST_CONN_PARAMS_UPDATE_DELAY      APP_TIMER_TICKS(5000)
    #define NEXT_CONN_PARAMS_UPDATE_DELAY       APP_TIMER_TICKS(30000)
    #define MAX_CONN_PARAMS_UPDATE_COUNT        3
    
    #define LESC_DEBUG_MODE                     0
    
    #define SEC_PARAM_BOND                      1
    #define SEC_PARAM_MITM                      0
    #define SEC_PARAM_LESC                      0
    #define SEC_PARAM_KEYPRESS                  0
    #define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_NONE
    #define SEC_PARAM_OOB                       0
    #define SEC_PARAM_MIN_KEY_SIZE              7
    #define SEC_PARAM_MAX_KEY_SIZE              16
    #define DEAD_BEEF                           0xDEADBEEF
    
    #define APP_BLE_CONN_CFG_TAG                1
    #define APP_BLE_OBSERVER_PRIO               3

    Thanks in advance.

    Best regards,

    Adarsh

Related