Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBLEClient cannot connect to specific BLE peripheral #102

Closed
pablosun opened this issue Jul 26, 2018 · 3 comments
Closed

LBLEClient cannot connect to specific BLE peripheral #102

pablosun opened this issue Jul 26, 2018 · 3 comments
Labels

Comments

@pablosun
Copy link
Contributor

Reproduce Steps

  1. Use LBLEClient to connect to a 3rd party BLE peripheral

Error & Expected Results

Cannot connect. However, the 3rd party BLE peripheral device can be connected by smart phones.

Log file: mabeee_device.txt

Environment

  • Arduino BSP Version: v0.10.18
@pablosun pablosun added the bug label Jul 26, 2018
@pablosun
Copy link
Contributor Author

It looks like that the connection is terminated by peripheral device immediately after connection.

[T: 28417 M: common C: info F: operator() L: 500]: ARD:bt_gap_le_connect() recieves BT_GAP_LE_CONNECT_IND
[T: 28438 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28447 M: BT C: info F: bt_debug_log L: 112]: [I][GAP] bt_gap_le_connection_update_proc: timer_id(0x0c002013)
[T: 28462 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28476 M: BT C: info F: bt_debug_log L: 112]: [I][ATT] bt_att_send_packet
[T: 28485 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_acl_le_send
[T: 28563 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28563 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 28563 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28647 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28647 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 28647 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28731 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_acl_proc
[T: 28731 M: BT C: info F: bt_debug_log L: 112]: [I][ATT] bt_att_send_packet
[T: 28731 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_acl_le_send
[T: 28731 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] LE acl Rx proc finished

[T: 28731 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28814 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28814 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 28814 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28898 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_acl_proc
[T: 28898 M: BT C: info F: bt_debug_log L: 112]: [I][ATT] bt_att_send_packet
[T: 28898 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_acl_le_send
[T: 28898 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] LE acl Rx proc finished

[T: 28898 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 28991 M: BT C: info F: bt_debug_log L: 112]: [I][GAP] bt_gap_le_connection_update_proc: timer_id(0x0c01033e)
[T: 28991 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] Rx proc: status(0x00000000)
[T: 29035 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_hci_evt_proc
[T: 29035 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] bt_timer_cancel_and_callback status: 0x04000002
[T: 29035 M: BT C: info F: bt_debug_log L: 112]: [I][GAP] bt_gap_le_event_callback: timer_id(0x0c010005)
[T: 29035 M: BT C: info F: bt_debug_log L: 112]: [I][GAP] BT_HCI_EVT_DISCONNECTION_COMPLETE: handle(0x0200)
[T: 29035 M: BTHCI C: info F: bt_debug_log L: 107]: [I][HCI] connection destroy, acl_credit_counter:8
[T: 29035 M: common C: info F: onEvent L: 612]: ARD:Disconnected with status = 0x0, reason = 0x3b
[T: 29035 M: BT C: info F: bt_debug_log L: 112]: [I][GAP] LE Connection Disconnected: handle(0x0200)

The Reason in BT_HCI_EVT_DISCONNECTION_COMPLETE is 0x3B, which is defined in bt_hci.h:

#define BT_HCI_STATUS_UNACCEPTABLE_CONNECTION_PARAMETERS     0x3B   /**< Unacceptable connection parameters. */

@pablosun
Copy link
Contributor Author

pablosun commented Jul 26, 2018

This may be related to the desired connection interval. We may try change the connection interval setting in LBLECentral.cpp to maximum value:

bool LBLEClient::connect(const LBLEAddress& address)
{
    bt_hci_cmd_le_create_connection_t conn_para;
    conn_para.le_scan_interval = 0x0010;
    conn_para.le_scan_window = 0x0010;
    conn_para.initiator_filter_policy = BT_HCI_CONN_FILTER_ASSIGNED_ADDRESS;
    conn_para.own_address_type = BT_ADDR_RANDOM;
    conn_para.conn_interval_min = 0x0006;
    conn_para.conn_interval_max = 0x0080;
    conn_para.conn_latency = 0x0000;
    conn_para.supervision_timeout = 0x07d0;
    conn_para.minimum_ce_length = 0x0000;
    conn_para.maximum_ce_length = 0x0050;
...

and change the line

conn_para.conn_interval_max = 0x0080;

to

conn_para.conn_interval_max = 0x0190;

@pablosun
Copy link
Contributor Author

We need to define bt_gap_le_is_connection_update_request_accepted to prevent remote peripheral from disconnecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant