Bluetooth connection problem
응답
15. 12. 21 오전 8:17
Dear all,

I am currently trying to get one of the Demo projects running to test the Bluetooth functionality of the XDK. Sadly I am not able to connect to it. While trying to connect it to a PC, the PC outputs after some time of pairing the error message "No pairing response received". My smartphone does not even give this error message but rather doesn't connect to the XDK in any way. Do you have any idea what the problem could be?

Best regards,

Kai
0 (0 투표)
Bluetooth connection problem
응답
15. 12. 22 오후 3:36 as a reply to Kai Clemens Liebich.
Hi Kai,

first, a few questions:

Are you trying the ADT_bleAccelData demo? If yes, try typing 'g' into the console to get the current BLE state.

Which mobile OS do you use? In another thread, someone successfully used this app for Android, and I used this app for iOS to get the demo working.

Are there any console outputs?

Also, it may be helpful to tell us all the steps you took by now.

With this information, we can hopefully solve your problem.

Kind regards,
Manuel
0 (0 투표)
Bluetooth connection problem
응답
15. 12. 23 오전 2:22 as a reply to Manuel Cerny.
Hello Manuel,

I tried the ADT_bleAccelData and the WBD_wifiBtleDemo. Both had the same issues. On my Smartphone I use Android 5.0.1 and my PC is a Laptop with Windows 7 and a Bluetooth 4.0 Stick from CSR. I never had any problems pairing both with other devices.
I already tried the console commands. This is the output I get (it is identical when I try to connect with the smartphone and PC):

 INFO | Connecting to XDK device 'eRickshaw' in port 'COM5'...
 INFO | Connection to port 'COM5' established
g
 INFO | Send message 'g' to device 'eRickshaw'
 INFO | ERICKSHAW: Device is in Discoverable Sate
 INFO | ERICKSHAW: Device connected  :
g
 INFO | Send message 'g' to device 'eRickshaw'
 INFO | ERICKSHAW: Device is Connected to a Host

The steps that I am performing are:
1. Open Demo project by clicking on it on the start window of the XDK.
2. Flash project.
3. Boot
4. Try to connect to XDK (it gets discovered by both devices without a problem)
5. Fail

I hope this helps you a bit. As both Demo projects are failing and I have the same problem with my smartphone and the PC I guess that the fault should be somewhere in the drivers for the Bluetooth on the XDK.

Kind regards,

Kai
0 (0 투표)
Bluetooth connection problem
응답
15. 12. 26 오후 4:30 as a reply to Kai Clemens Liebich.
Hi Kai,

I'm a little confused as the application seems to think that it is connected to a device.

Just to be sure, did you check that the phone supports Low Energy mode?

What makes you think that your smartphone/PC isn't connected to the XDK? Do you have a way to display connected devices and available services and characteristics (like the app I linked to in my last post)?

If there really is a bug in the Alpwise stack, I will have to forward this to second level support as I can't recreate this issue myself.

Kind regards,
Manuel
0 (0 투표)
Bluetooth connection problem
응답
15. 12. 29 오전 2:44 as a reply to Manuel Cerny.
My smartphone is the HTC One M7 it has Bluetooth 4.0 LE. Every paired device is usually listed as paired but not the XDK.
On the PC i use this Bluetooth 4.0 Dongle: http://www.amazon.in/dp/B00WCXUV5M. While the HTC One just doesn't connect, the PC delivers this Error Message: "No pairing response received".
 
0 (0 투표)
Bluetooth connection problem
응답
15. 12. 29 오후 5:58 as a reply to Kai Clemens Liebich.
Hi Kai,

your observations only suggest that pairing doesn't work. But (according to my tests) the Data Exchange Service used in the demo works without pairing. Please try the mentioned app to check if you can connect to the XDK and use services, disregarding of the fact that the device isn't paired.

If you want to try debugging the pairing yourself (as I said, I currently can't recreate your setup), you could start on line 168 in the file [SDK-ROOT]/platform/device/BLE/BLE_alpwiseDriver/BLE_stateHandler/BLE_stateHandler_cc.c.

Kind regards,
Manuel
0 (0 투표)
Bluetooth connection problem
응답
16. 2. 23 오후 2:26 as a reply to Manuel Cerny.
Hello,

I have the same problem like Kai. I can find the XDK as BLE device under linux both with hcitool and pygatt (via python), but I cannot connect to it (gatttool and pygatt). It says, the connection will be refused.
Manuel, do I understand you right, that it is possible to get the acceleration data without connecting? Do you know how to extract the data with pygatt?
Another question: Why is the BLE device address of the XDK changing after power down? Shouldn't bluetooth devices have a unique address just like the MAC address?

Thanks,
Jürgen
 
0 (0 투표)
Bluetooth connection problem
응답
16. 2. 28 오후 3:30 as a reply to Jürgen Schuster.
Hello Juergen,

first, please make sure that your system supports Bluetooth Low Energy (Bluetooth 4.0).

You always need to connect to a Bluetooth device in order to send data to or receive data from it's characteristics. However, you don't need to pair with the device (and probably can't with the XDK).

With pygatt, something like this should work (not tested!):

adapter = pygatt.backends.GATTToolBackend()
device = adapter.connect('FC:D6:BD:XX:XX:XX') // set address on XDK or find out some other way
device.char_write("00005303-0000-0041-4C50-574953450000", bytearray("start"), true)
device.subscribe("00005302-0000-0041-4C50-574953450000", YOUR_CALLBACK, false)


In my tests I sometimes had to restart the XDK and try multiple times to connect to the device (my XDK sometimes doesn't respond to connection requests but still switches it's state to connected).

For your question about the BLE device address, please have a look at this thread.

Kind regards,
Manuel
0 (0 투표)
Bluetooth connection problem
응답
16. 2. 29 오후 2:08 as a reply to Manuel Cerny.
Hello Manuel,

I tried 4 different BLE dongles, 3 works with.GATTToolBackend and gatttool/hcitool, 1 works with BGAPIBackends.
I cannot connect to the device:
gatt = pygatt.backends.GATTToolBackend()
device = gatt.connect('CF:45:0D:3C:19:7E')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pygatt-2.0.1-py2.7.egg/pygatt/backends/gatttool/gatttool.py", line 190, in connect
    raise NotConnectedError(message)
pygatt.exceptions.NotConnectedError: <NotConnectedError Timed out connecting to CF:45:0D:3C:19:7E after 5.0 seconds.>
The (random) Bluetooth address I found out by: sudo hcitool lescan. The scan method of GATTToolBackend doesn't work with all 3 dongles. Maybe there is a problem with pygatt package?
With another BLE dongle, BGAPIBackend can scan the device but not connect.
Now we try to connect by WiFi and HTTP, but that's very slow.

Bye,
Jürgen
0 (0 투표)
Bluetooth connection problem
응답
16. 3. 1 오후 7:54 as a reply to Jürgen Schuster.
Hello Juergen,

are there entries in the XDK workbench console that the XDK changed to state "Connected" after a connection attempt from pygatt? If yes, maybe retry the connect command several times just to be sure.

You can also try to connect to the XDK with one of the apps I linked a few posts ago, just to be sure that there's no problem on the XDK side.

Since I currently don't have a BLE dongle available and also haven't heard of another user who tried this, I can't tell you if pygatt will work with the XDK, but theoretically it should.

Kind regards,
Manuel
0 (0 투표)
Bluetooth connection problem
응답
16. 3. 2 오후 1:14 as a reply to Manuel Cerny.
Hello  Manuel,

pygatt.backends.GATTToolBackend is a wrapper for gatttool. So I also tried gatttool from command line and had the same problem with the XDK: "connection refused". Tried connecting many times, XDK always says: "Device is in Discoverable State" (SendAccelerometerDataOverBle). The app BLE Tool works well with the XDK when I tested it.

Bye,
Jürgen
0 (0 투표)
Bluetooth connection problem
응답
16. 3. 2 오후 9:14 as a reply to Jürgen Schuster.
Hello Juergen,

ok, maybe gatttools connection requests are in some way not formed like the XDK expects them to be ...
I will ask the BCDS team if they have a solution for this.

Kind regards,
Manuel
0 (0 투표)
RE: Bluetooth connection problem
응답
16. 6. 10 오전 9:08 as a reply to Manuel Cerny.

Hello Jürgen,

Sorry for the long delay. In actual fact, this is a topic outside of the supported area of the XDK. Nevertheless I have a small update to this topic:

We tried to reproduce your issue, and it reveals to be a problem with GATT & HCI tools. The issue occuring with gatt and HCI tools points to required manual steps bevor a connection and data exchange with the XDK can be done. We also tried the LightBlue App for OS X that worked without any problem. It seems that the just works pairing with HCI tool can’t be done correctly and needs to be adapted.

One more improvement that is maybe a solution to you: “Now we try to connect by WiFi and HTTP, but that's very slow”:

HTTP brings much overhead with it. If you want to get it faster over Wi-Fi you could use UDP instead of HTTP(TCP).

Kind regards,
Manuel

0 (0 투표)
RE: Bluetooth connection problem
응답
16. 6. 29 오전 7:56 as a reply to Manuel Cerny.

Hello Manuel,

Just looked into the forum after a long time and found your new answer. Yes, UDP is much quicker as HTTP(TCP), so we actually use it to transfer the data and use BLE only for range detection (by RSSI, not really precise, but good enough). Apart from the problem that the XDK sometimes stops while sending UDP and has to be restarted, this works fine.  But a fix to pair with HCI tool would be nice.

Bye,

Jürgen

0 (0 투표)
RE: Bluetooth connection problem
응답
16. 6. 29 오전 8:56 as a reply to Jürgen Schuster.

Hello Jürgen,

we know that UDP has some stability problems and we are just about to fix it. I guess in the next workbench release it will be solved.

I will add the pairing with HCI tools to our internal improvement list.

- Manuel

0 (0 투표)