[Bluez] BLE auto-disconnect after connected a few seconds

cancel
Showing results for 
Search instead for 
Did you mean: 

[Bluez] BLE auto-disconnect after connected a few seconds

Jump to solution
541 Views
Contributor IV

Hi 

I have some troubles when using Bluez but I don't know how to contact the Bluez's author, so I try contacting you to solve this problem.

When I use bluetoothctl to connect classic bluetooth( scan->pair->connect, e.g. BT mouse),it works well.

But when I try to connect a BLE device (scan->connect, e.g. BLE heart pressure device),it just can connect on a few seconds then disconnect.

After that, I try to update the Bluez(from 5.37 to 5.50), it doesn't work for solving this problem.

Here is the output when I connect BLE device:

[bluetooth]# connect 60:64:05:AE:64:B2
Attempting to connect to 60:64:05:AE:64:B2

[ 1400.135723] rtk_btusb: hci0 evt 1

[ 1400.140779] rtk_btusb: btusb_notify : hci0 evt 1
[ 1404.139839] rtk_btusb: update_profile_connection: is_add=1, profile_index=1
[TSB-631]#

[ 1404.155183] rtk_btusb: update_profile_connection: usb_coex_info.profile_bitmap = 2
[CHG] Device 60:64:05:AE:64:B2 Connected: yes

[ 1404.162954] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[0] = 0

[ 1404.162325] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[1] = 1
94m[TSB-631]#

[ 1404.184793] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[2] = 0
[ 1404.194373] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[3] = 0
[ 1404.202424] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[4] = 0
[ 1404.210512] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[5] = 0
[ 1404.218559] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[6] = 0
[ 1404.226588] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[7] = 0
[ 1404.234628] rtk_btusb: rtk_notify_profileinfo_to_fw, BufferSize is 5
[ 1404.240989] rtk_btusb: rtk_notify_profileinfo_to_fw, NumberOfHandles is 1
[ 1404.247823] rtk_btusb: rtk_notify_profileinfo_to_fw, handle is 10
[ 1404.253945] rtk_btusb: rtk_notify_profileinfo_to_fw, profile_bitmap is 2
[ 1404.260712] rtk_btusb: rtk_notify_profileinfo_to_fw, profile_status is 0
[ 1404.267464] rtk_btusb: rtk_vendor_cmd_to_fw, opcode is 0xfc19
[ 1404.273241] rtk_btusb: in hci_cmd_task, coex_info.num_hci_cmd_packet is 1
[ 1404.280089] rtk_btusb: send cmd to fw, opcode = 0xfc19
[ 1404.285291] rtk_btusb: update_hid_active_state: handle = 10, interval = 0x36
[ 1404.292537] rtk_btusb: rtk_notify_profileinfo_to_fw, BufferSize is 5
[ 1404.299032] rtk_btusb: rtk_notify_profileinfo_to_fw, NumberOfHandles is 1
[ 1404.305847] rtk_btusb: rtk_notify_profileinfo_to_fw, handle is 10
[ 1404.311946] rtk_btusb: rtk_notify_profileinfo_to_fw, profile_bitmap is 12
[ 1404.318759] rtk_btusb: rtk_notify_profileinfo_to_fw, profile_status is 2
[ 1404.325494] rtk_btusb: rtk_vendor_cmd_to_fw, opcode is 0xfc19
[ 1404.331260] rtk_btusb: in hci_cmd_task, coex_info.num_hci_cmd_packet is 0
[ 1404.338110] rtk_btusb: in hci_cmd_task, coex_info.num_hci_cmd_packet is 1
[ 1404.344941] rtk_btusb: send cmd to fw, opcode = 0xfc19
Connection successful
[TSB-631]#

[ 1406.064943] rtk_btusb: update_profile_connection: is_add=0, profile_index=1
[ 1406.071951] rtk_btusb: for test: --, usb_coex_info.profile_refcount[1] = 0
[bluetooth]#

[ 1406.083782] rtk_btusb: update_profile_connection: usb_coex_info.profile_bitmap = 0
[CHG] Device 60:64:05:AE:64:B2 Connected: no

[ 1406.091852] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[0] = 0

[ 1406.091937] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[1] = 0

4m[bluetooth]#

[ 1406.113534] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[2] = 0
[ 1406.124231] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[3] = 0
[ 1406.132260] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[4] = 0
[ 1406.141209] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[5] = 0
[ 1406.149290] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[6] = 0
[ 1406.157413] rtk_btusb: hci0 evt 2
[ 1406.160774] rtk_btusb: btusb_notify : hci0 evt 2
[ 1406.165898] rtk_btusb: update_profile_connection: usb_coex_info.profile_refcount[7] = 0
[ 1406.173951] rtk_btusb: rtk_notify_profileinfo_to_fw, BufferSize is 2
[ 1406.180328] rtk_btusb: rtk_notify_profileinfo_to_fw, NumberOfHandles is 0
[ 1406.187146] rtk_btusb: rtk_notify_profileinfo_to_fw, profile_status is 0
[ 1406.193881] rtk_btusb: rtk_vendor_cmd_to_fw, opcode is 0xfc19
[ 1406.199653] rtk_btusb: in hci_cmd_task, coex_info.num_hci_cmd_packet is 1
[ 1406.206497] rtk_btusb: send cmd to fw, opcode = 0xfc19

——————————————————————————————————

It can keep the connection 5~20 seconds. 

I'm using IMX6DL, kernel 4.1.15 (fsl-img-qt5)

What should I do ?

Regards

Mihan

Labels (1)
Tags (2)
0 Kudos
1 Solution
428 Views
NXP TechSupport
NXP TechSupport

Hi 铭恒 李

reason for disconnection may be timings mismatch as explained on

BLE disconnects immediately after connection | Cypress Developer Community 

For bluez 5.50 may be recommended latest kernels, like L4.19.35

i.MX Software and Development Tools | NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
428 Views
Contributor IV

Also, I found when I try to connect the BLE device after updating the bluez to 5.50,the bluetoothd will be crash with illegal instruction signal ( because the bluetoothctl will unregister agent then I use ctrl + C to close the bluetoothctl).

Here is GDB output:

Core was generated by `/usr/libexec/bluetooth/bluetoothd'.
Program terminated with signal SIGILL, Illegal instruction.
#0 0x000f3b90 in read_by_grp_type_cb ()
(gdb) where
#0 0x000f3b90 in read_by_grp_type_cb ()
#1 0x000e0da4 in handle_rsp ()
#2 0x000e1388 in can_read_data ()
#3 0x000f1e68 in watch_callback ()
#4 0x76e5797c in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#5 0x76e57d14 in ?? () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

0 Kudos
429 Views
NXP TechSupport
NXP TechSupport

Hi 铭恒 李

reason for disconnection may be timings mismatch as explained on

BLE disconnects immediately after connection | Cypress Developer Community 

For bluez 5.50 may be recommended latest kernels, like L4.19.35

i.MX Software and Development Tools | NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
428 Views
Contributor IV

BTW,  I have download the latest kernel by following your suggestion above. But I found the rootfs without qt, so how to add qt into the rootfs.

 

I had gotten an old document about How to build QT for IMX6. But the git of QT in that document is invalid. 

Could you tell me a new method to add Qt or must I rebuild the image and rootfs by following the user's guide?

0 Kudos
428 Views
Contributor IV

Hi

I refrashed the system root (for bluez 5.37).

Then I found that if I use "hcitool" to "lecc"(connect BLE) device, it works well, but if I use "bluetoothctl" to connect the same device,it would be disconnected like the description above but without the bluetoothd crashed. 

Is the problem still the timings mismatch?

0 Kudos
428 Views
Contributor IV

Thanks a lot.I will read it later.

Does it say how to solve timings mismatch between devices?

0 Kudos