Hi Dialog,
I am developing a device and an app and using DSPS for communication.
All is working relatively well but our device do not connect to some Android Tablet, We do not have many tablets to check, but "Lenovo TAB 4 10" (TB X704L) fail to connect to our device. most tablets and phones are working well.
Trying to debug it I am using your DSPS app.
I see the connection established and disconnect immediately.
when using the android's Bluetooth setting, trying to connect the device result with the error popup: "Couldn't pair with BLE because of an incorrect PIN or passkey" - My device configuration is "just work" no authentication, no passkey, no security so this message is puzzling....
I did some research: adding authentication to the device did not change the behavior and no other configuration change i tried made any change.
At one instance, there was successful connection with the tablet, and the DSPS app was momentary working fine. I couldn't reproduce it.
my question:
Have you ever encounter such issue?
it seems like the initial "handshake" between the device and the tablet fail some ware. any suggestion where should I look?
Thanks,
Raz
Hirazp:
Can you clear any existing entry for your peripheral on the tablet, and try again.
Otherwise, we will need a Bluetooth sniffer log.
Thanks,
TR_DIALOG
Hi TR.
Please elaborate.
1. What is "clear any existing entry for your peripheral on the tablet"
2. how do I get Bluetooth sniffer log?
Raz
Hi razp:
1. What is "clear any existing entry for your peripheral on the tablet"
[TR_DIALOG] This should be somewhere under Bluetooth settings of your tablet. I don't have an Android device with me, so don't have information about specific Android settings.
2. how do I get Bluetooth sniffer log?
(TR_DIALOG)强g a commercial Bluetooth sniffer such as one from Frontline or other vendors.
Thanks,
TR_DIALOG
Hi TR,
Thank you fro your help.
There is no such setting in this tablet or any other Android tablet / phone, but i did a "Network Setting Reset". This did not change the connection behavior.
Unfortunately we do not have a "commercial Bluetooth sniffer".
Can I log the communication from within the Dialog SDK?
Kind regards,
Raz
如果有机会,你的平板电脑是成对with the device from previous use, go to Settings/Connections/Bluetooth and clear the pairings (a gear icon should be displayed to the right of each paired device. Clear the pairing/bonding by clicking "Unpair")
/MHv
It never successfully connected to the device.
I am trying to debug the issue in the device end. Looking at the event sequence this is what I see.
Good
t:14 m: 1 GAPC_CONNECTION_REQ_IND
设备连接
t:13 m: 0 GAPM_CMP_EVT
t:54 m: 3 SPS_SERVER_CREATE_DB_CFM
t:54 m: 3 SPS_SERVER_CREATE_DB_CFM
Profile Enabled
t:14 m: 0 GAPC_CMP_EVT
t:12 m: 0 GATTC_CMP_EVT
t:12 m: 0 GATTC_CMP_EVT
t:14 m:17 GAPC_PARAM_UPDATED_IND
t:14 m:17 GAPC_PARAM_UPDATED_IND
t:14 m:23 GAPC_ENCRYPT_REQ_IND
t:14 m:23 GAPC_ENCRYPT_REQ_IND
Not good
t:14 m: 1 GAPC_CONNECTION_REQ_IND
设备连接
t:13 m: 0 GAPM_CMP_EVT
t:54 m: 3 SPS_SERVER_CREATE_DB_CFM
t:54 m: 3 SPS_SERVER_CREATE_DB_CFM
Profile Enabled
t:14 m: 3 GAPC_DISCONNECT_IND
Device disconnected
t:14 m: 0 GAPC_CMP_EVT
about the logs
t:task_num m:message num
The messages names are my interpretation based on the code.
These logs do not make sense to me yet, maybe it will to you.
I am not yet convinced if this is a device issue, a tablet issue or maybe, a different interpretation of the BLE protocol.
hope you can help
Raz
The Tablet apparently decides to disconnect for some reason. DSPS will try to negotitate more optional connection parameters, and it is possible that the tablet chokes on this. I suggest that we take a step back and have you build and load empty_peripheral_template onto your target. This project is 100% hardware agnostic and can run on any hardware featuring the DA14580. Please use a generic Bluetooth app (BlueLoupe or BLE Scanner) and verify that the tablet connects and stays connected with target.
Also, please provide the Andriod version on the tablet.
/MHv
Hi MHv,
good call, the tablet connects and stays connected with target.
Android version on the tablet is 7.1.1
What should my next step be?
I am trying to pinpoint the issue looking at the communications RX/TX on the device. where would it be a good place in the code to place loggers for the RX and TX communications?
Kind regards,
Raz
Let's start by removing the MTU exchange that takes place when the connection is initiated. Try to out-comment the function call to user_gattc_exc_mtu_cmd() in the user_on_connection() callback function of DSPS. If this "fixes" the problem, we would have a good indication of where to look next.
/MHv
Thank you MHv
I did as suggested and the result are inconclusive: A successful connection was made, but not every time.
to get a successful connection I need to do multiple tries (click on the item in the list) most of the times I get "Connection failed" error and once in a while I have a success. moreover, it seems I need to reset the device between successes.
In the android's Bluetooth setting, I no longer get the error popup: "Couldn't pair with BLE because of an incorrect PIN or passkey"
Kind regards,
Raz
That is still good data. Next, try to also outcomment the call to app_easy_gap_param_update_start() - same function. This should allow the tablet to completely dictate the connection parameters without any negotiation. This will also limit the throghput dramatically, but it will show us where to tweak the connection parameters.
/MHv
With this change there is no problem to connect the device to the tablet and transfer data.
Raz
We are definitely getting somewhere here...
I suggest that we (well you ;o) do the following:
/MHv
Hi MHv,
Thank you for your patient.
The 3rd point is working. I delayed the call to user_gattc_exc_mtu_cmd() and app_easy_gap_param_update_start() by 10ms and it seems everything is working fine with the tablet.
You suggested 1-2 seconds delay. is 10ms too short?
Any idea how will this change affect the majority of android / iOS devices that are working fine with the original implementation?
Kind regards,
Raz
That is great news. I don't think the duration of the delay is all that important. The tablet appears to not be able to handle the previous timing of activities and any separation of events would help.
Both Android and iOS works in mysterious ways ;o), but it is safe to save that your code changes have made DSPS more inclusive and will work with more devices than the original code. I will suggest to our applications team that they look at your fix as something they should potentially roll in to any future DSPS updates.
/MHv