Hello,
I am trying to pair my Hexiwear which uses KW40Z to communicate with my linux OS.
I have written a software using QT Creator, and using that I was able to pair my cell phone with my laptop.
But I can not pair my hexiwear with laptop, I need this to read sensors on the hexiwear.
On the other hand the hexiwear is paired with my cell phone which uses android.
I was wondering if anybody can help me with this. I don't know whether this is possible or not?
I fixed the firmware loading issue, but I still get the same AuthenticationFailed error.
When the AuthenticationFailed happens, what's the dmesg output?
Are you able to connect with a different BLE device? Just to figure out if the issue is with authentication only or also with devices without security.
Not sure how the custom firmware affects BlueZ stack, but might worth search for that as well.
here is a log of my commands in terminal.
Authentication fails in the last line.
$ bluetoothctl
[NEW] Controller 5C:F3:70:78:1F:70 VGNFW490JAB [default]
[NEW] Device 00:2C:40:0B:00:27 HEXIWEAR
[bluetooth]# power off
Changing power off succeeded
[CHG] Controller 5C:F3:70:78:1F:70 Powered: no
[CHG] Controller 5C:F3:70:78:1F:70 Discovering: no
[CHG] Controller 5C:F3:70:78:1F:70 Class: 0x000000
[bluetooth]# power on
[CHG] Controller 5C:F3:70:78:1F:70 Class: 0x0c010c
Changing power on succeeded
[CHG] Controller 5C:F3:70:78:1F:70 Powered: yes
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 5C:F3:70:78:1F:70 Discovering: yes
[CHG] Device 00:2C:40:0B:00:27 RSSI: -60
[bluetooth]# scan off
[CHG] Device 00:2C:40:0B:00:27 RSSI is nil
[CHG] Controller 5C:F3:70:78:1F:70 Discovering: no
Discovery stopped
[bluetooth]# trust 00:2C:40:0B:00:27
[CHG] Device 00:2C:40:0B:00:27 Trusted: yes
Changing 00:2C:40:0B:00:27 trust succeeded
[bluetooth]# pair 00:2C:40:0B:00:27
Attempting to pair with 00:2C:40:0B:00:27
[CHG] Device 00:2C:40:0B:00:27 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device 00:2C:40:0B:00:27 Connected: no
this is the output for dmesg which are related to bluetooth
[ 201.080928] Bluetooth: Core ver 2.21
[ 201.081042] NET: Registered protocol family 31
[ 201.081045] Bluetooth: HCI device and connection manager initialized
[ 201.081051] Bluetooth: HCI socket layer initialized
[ 201.081056] Bluetooth: L2CAP socket layer initialized
[ 201.081064] Bluetooth: SCO socket layer initialized
[ 201.133891] usbcore: registered new interface driver btusb
[ 201.144066] Bluetooth: hci0: BCM: chip id 63
[ 201.169112] Bluetooth: hci0: BCM20702A
[ 201.170103] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 202.817037] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1338
[ 202.838043] Bluetooth: hci0: Broadcom Bluetooth Device
[ 203.159860] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 203.159865] Bluetooth: BNEP filters: protocol multicast
[ 203.159871] Bluetooth: BNEP socket layer initialized
[ 203.349383] Bluetooth: RFCOMM TTY layer initialized
[ 203.349393] Bluetooth: RFCOMM socket layer initialized
[ 203.349402] Bluetooth: RFCOMM ver 1.11
[ 521.010907] perf interrupt took too long (2506 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
this is the output for journalctl -f when I connect my BTUSB to my laptop
Jul 13 13:03:08 mohammad-VGNFW490JAB kernel: usb 6-2: new full-speed USB device number 3 using uhci_hcd
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: usb 6-2: New USB device found, idVendor=0a5c, idProduct=21e8
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: usb 6-2: Product: BCM20702A0
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: usb 6-2: Manufacturer: Broadcom Corp
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: usb 6-2: SerialNumber: 5CF370781F70
Jul 13 13:03:09 mohammad-VGNFW490JAB mtp-probe[3087]: checking bus 6, device 3: "/sys/devices/pci0000:00/0000:00:1d.0/usb6/6-2"
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: Bluetooth: hci0: BCM: chip id 63
Jul 13 13:03:09 mohammad-VGNFW490JAB systemd[1]: Starting Load/Save RF Kill Switch Status...
Jul 13 13:03:09 mohammad-VGNFW490JAB mtp-probe[3087]: bus: 6, device: 3 was not an MTP device
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: Bluetooth: hci0: BCM20702A
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: Bluetooth: hci0: BCM20702A1 (001.002.014) build 1338
Jul 13 13:03:09 mohammad-VGNFW490JAB kernel: Bluetooth: hci0: Broadcom Bluetooth Device
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Failed to obtain handles for "Service Changed" characteristic
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Error adding Link Loss service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Current Time Service could not be registered
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: gatt-time-server: Input/output error (5)
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Not enough free handles to register service
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Sap driver initialization failed.
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: sap-server: Operation not permitted (1)
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Endpoint registered: sender=:1.70 path=/MediaEndpoint/A2DPSource
Jul 13 13:03:09 mohammad-VGNFW490JAB bluetoothd[2022]: Endpoint registered: sender=:1.70 path=/MediaEndpoint/A2DPSink
Jul 13 13:03:10 mohammad-VGNFW490JAB systemd[1]: Reached target Bluetooth.
Jul 13 13:03:10 mohammad-VGNFW490JAB systemd[1]: Started Load/Save RF Kill Switch Status.
I can pair any bluetooth device that I have with these commands such as Android phone, iPhone, headphone, speaker
but I don't know what is wrong with HEXIWEAR.
What do you mean by "custom firmware affects BlueZ stack"?
there was one time that instead of Authentication fail I got Timeout error, and HEXIWEAR vibrated twice.
but after that I always get Authentication failed.
[bluetooth]# pair 00:2C:40:0B:00:27
Attempting to pair with 00:2C:40:0B:00:27
[CHG] Device 00:2C:40:0B:00:27 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationTimeout
[CHG] Device 00:2C:40:0B:00:27 Connected: no
I am using a USB Bluetooth 4.x dongle, and I am programming in Ubuntu Linux.
Right now, when I search for Bluetooth devices I can see the Hexiwear listed in my program
but I cant pair it
Carlos,
Thank you for all of these valuable information.
The only difference between you and me is that I don't use USB-KW40Z dongle, I have Belkin USB dongle.
I went through step by step of your instruction, but I encountered an error in step 6 when I wanted to pair my hexiwear.
below shows my terminal output.
[bluetooth]# pair 00:2C:40:0B:00:27
Attempting to pair with 00:2C:40:0B:00:27
[CHG] Device 00:2C:40:0B:00:27 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device 00:2C:40:0B:00:27 Connected: no
Is it because of my USB dongle or I need to do something else?
using these commands I could pair my android phone but I did not have any
success with HEXIWEAR!
Thanks
can you do a dmesg and see if there's an error log there?
The first attempts I did, had a similar issue and found that doing the power on/ff fixed for me.
according to dmesg my bluetooth firmware fails to load!!
[ 367.924176] Bluetooth: hci0: BCM: chip id 63
[ 367.955181] Bluetooth: hci0: BCM20702A
[ 367.957183] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 367.957207] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e8.hcd failed with error -2
[ 367.957211] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found
[ 368.159042] Bluetooth: RFCOMM TTY layer initialized
[ 368.159051] Bluetooth: RFCOMM socket layer initialized
[ 368.159059] Bluetooth: RFCOMM ver 1.11
I'm also trying to connect a Hexiwear to a Windows 10 PC so we can connect to it using our graphical programming language FlowStone.
I have it paired using a Bluetooth 4.x dongle so everything looks ok.
Do you have a Windows API to connect as a GATT Client?
Hi,
Usually BLE dongles have only HCI interface, so you have to use the Host Stack implemented by the PC Host (Win10 in your case). We don't offer any SDK for interacting with Win10 Bluetooth Host Stack.
As an alternative you can use an USB-KW40Z dongle with BLE_FSCI_App that has a Host Stack implemented and exposes a GATT, GATTDB and GAP API.
BR,
Alex
Do you mean the NXP - DEV BRD, MKW40Z160 packet Sniffer Dongle?
If so these are too expencive as they cost more than the Hexiwear. We are tyying to make a low cost product for education simular to our FlowPaw product we made with MikroE.
If you have any pointers it would be apreciated..
Carl..
Hi,
One thing you can do is check if your laptop has a Bluetooth 4.x transceiver. Smartphones can connect to 2.1 or 3.0 devices (which is what most old laptops support), but KW40Z if Bluetooth 4.1 so it can only pair with 4.x devices.
If your laptop does not support 4.x, you should use a Bluetooth 4.x dongle via your USB port.
BR,
Alex