DSPS not working with some tablets

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
16 posts / 0 new
Last post
razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
DSPS not working with some tablets

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

Device:
TR_Dialog
Offline
Last seen:2 months 4 days ago
工作人员
加入:2014-06-30 23:52
Hi razp:

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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
Hi TR.

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

TR_Dialog
Offline
Last seen:2 months 4 days ago
工作人员
加入:2014-06-30 23:52
Hi razp:

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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
Hi TR,

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

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
If there is a chance that

如果有机会,你的平板电脑是成对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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
It never successfully

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

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
The Tablet apparently decides

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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
Hi 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

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
Let's start by removing the

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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
Thank you 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

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
That is still good data. Next

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

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
With this change there is no

With this change there is no problem to connect the device to the tablet and transfer data.

Raz

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
We are definitely getting

We are definitely getting somewhere here...

I suggest that we (well you ;o) do the following:

  • Try to allow the MTU exchange again to see if the connection parameter negotiation is the culprit.
  • After the above test. Start tweaking the connection parameters in the update request sent from the device. The connection interval is a potential issue. Some, maybe most, Android devices appear to accept 7.5ms intervals. A default connection (where the peripheral device doesn't request updates), is typically established at 30ms, and you could try to slowly decrease this in the update request
  • You may also try to use an app_easy_timer to delay the update request by a second or two. During the connection initiation, there is quite a lot going on, and the tablet may struggle with all these activities when the update request is received. Delaying the request, may resolve the issue. Try with the original parameters after the delay has been implemented.

/MHv

razp
Offline
Last seen:1 year 5 months ago
加入:2017-02-08 09:20
Hi 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

MHv_Dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2013-12-06 15:10
That is great news. I don't

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