- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Per the thread here: Pairing process with Passkey not completed - (MASTER: BCM20737S, SLAVE: BCM20737S)
I have the same problem as I'm basing our project on the hello_client and hello_sensor examples. Bonding finishes with error code 0x04 despite we are using the SDK 2.2.3.
Is there a particular way to configure the master and slave in regards to the LESMP_IO_CAP_DISP_ONLY, LESMP_IO_CAP_DISP_KEYBOARD_ONLY,...
What we are trying to accomplish is to bond two devices where the key is set programatically. There is no user entering any key through a keyboard or anything like this.
- Tags:
- pairing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error code 0x04 according to BT specs is "Page Timeout". I suspect that it occurred when the client is trying to create a connection with the peripheral, but the latter did not respond in time.
You may refer to lesmp_const.h on how to configure the IO. I extracted that part over here:
// IO Capability
#define LESMP_IO_CAP_DISP_ONLY 0x00
#define LESMP_IO_CAP_DISP_YES_NO 0x01
#define LESMP_IO_CAP_DISP_KEYBOARD_ONLY 0x02
#define LESMP_IO_CAP_DISP_NO_IO 0x03
#define LESMP_IO_CAP_DISP_KEYBOARD_DISP 0x04
#define LESMP_IO_CAP_MAX LESMP_IO_CAP_DISP_KEYBOARD_DISP // last one
As far as the bonding process between a client and a peripheral, I referred to the hello_client and hello_sensor apps, and found no issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for copy/pasting the options from the header file. I knew about those options, the question is how to set them properly. I pretty much tried every combination, but none work. Even as they are set in the hello_sensor and hello_client examples doesn't work for me.
Can you share an example that you have confirmed is working on your side ?
Additionally, do we need to do anything with the "lesmp_setSMPRole()" function in either of the slave or master ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was using the default hello_client app and hello_sensor app within the SDK (2.2.3).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would it be possible to provide the trace output for both so I can compare it with my to identify where things get broken.
What do I see is that the connection gets established. Then I've receive a bond result of 0 and shortly after that a bond result of 4. Both in the bond_result callback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, the reason it didn't work for two tag boards is because one of the tags must have a display for user to enter the passkey. Which side are you working? I suggest you use apps like LightBlue (on iOS) so that you can enter those passkeys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On my sensor (our custom device) side my setup is:
lesmp_setPairingParam(
LESMP_IO_CAP_DISP_ONLY,
LESMP_OOB_AUTH_DATA_NOT_PRESENT, // OOBDataFlag,
LESMP_AUTH_FLAG_BONDING // AuthReq,
| LESMP_AUTH_REQ_FLAG_MITM,
LESMP_MAX_KEY_SIZE, // MaxEncKeySize,
// InitiatorKeyDistrib,
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY,
// ResponderKeyDistrib
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY);
And on my client (our custom device) side:
lesmp_setPairingParam(
LESMP_IO_CAP_DISP_NO_IO,
LESMP_OOB_AUTH_DATA_NOT_PRESENT, // OOBDataFlag,
LESMP_AUTH_FLAG_BONDING // AuthReq,
| LESMP_AUTH_REQ_FLAG_MITM,
LESMP_MAX_KEY_SIZE, // MaxEncKeySize,
// InitiatorKeyDistrib,
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY,
// ResponderKeyDistrib
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY);
With this configuration my "bonded" callback gets invoked two times on the sensor side, despite I just make 1 connection request:
1) The 1st time with bonding result 0 (failure)
2) The 2nd time with bonding result 4 (code not documented)
The time difference between those two is ~4ms.
According to the table you are providing this is a valid configuration unless I miss something.
If I try to connect to the sensor via an iPhone or Android it works with bonding result 3 (success).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sensor: Display only
Client: No I/O
The above combination may only work for "just work" and not with "passkey entry".
I suggest that you chose something else (if possible with HW) for your client like "keyboard" or "keyboard display"
The reason there is no issue connecting with a smart phone is because it has the ability to enter the passkey (keyboard).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response.
I've tried that and in this case the smp_bond_result callabck is never invoked on the sensor (slave) side and eventually it times out with a bond result of 1.
Below is a code snipped from teh master side:
puart_control_connection_up() {
...
...
...
if (puart_control.conn[cm_index].dev_info.role == ROLE_MASTER)
{
blecen_connUp();
if (bleprofile_p_cfg->encr_required != 0)
{
blecm_SetPtrConMux(con_handle);
lesmp_setPtr(&puart_control.conn[cm_index].smp_info);
lesmp_startPairing(NULL);
...
...
...
}
puart_control_create() {
...
...
...
lesmp_setSMPRole(LESMP_ROLE_INITIATOR);
lesmp_setPairingParam(
LESMP_IO_CAP_DISP_KEYBOARD_DISP,
LESMP_OOB_AUTH_DATA_NOT_PRESENT, // OOBDataFlag,
LESMP_AUTH_FLAG_BONDING // AuthReq,
| LESMP_AUTH_REQ_FLAG_MITM,
LESMP_MAX_KEY_SIZE, // MaxEncKeySize,
// InitiatorKeyDistrib,
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY,
// ResponderKeyDistrib
LESMP_KEY_DISTRIBUTION_ENC_KEY
| LESMP_KEY_DISTRIBUTION_ID_KEY
| LESMP_KEY_DISTRIBUTION_SIGN_KEY);
UINT32 key_ = 4794;
BT_MEMSET(puart_control.key, 0, LESMP_MAX_KEY_SIZE);
puart_control.key[0] = key_ & 0xff;
puart_control.key[1] = (key_ >> 😎 & 0xff;
puart_control.key[2] = (key_ >> 16) & 0xff;
puart_control.key[3] = (key_ >> 24) & 0xff;
lesmp_setSMPassKey(puart_control.key, LESMP_MAX_KEY_SIZE);
lesmp_setJustWorksNotPermitted();
...
...
...
}
I have a feeling there are issues with the SDK or I'm doing something fundamentally wrong. I would appreciate if you contact me privately so we can discuss this to a resolution as this is becoming a real issue here at my company. After that I don't mind exposing the solution here so others can benefit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to expand a little on the table you are referring to in the pdf file. Below is a summary of all the combinations:
DisplayOnly | DisplayYesNo | KeyboardOnly | No IO | KeyboardDisplay | |
DisplayOnly | JW | JW | PK | JW | PK |
DisplayYesNo | JW | JW | PK | JW | PK |
KeyboardOnly | PK | PK | PK | JW | PK |
No IO | JW | JW | JW | JW | JW |
KeyboardDisplay | PK | PK | PK | JW | PK |
So depending on what the initiator and responder have, the corresponding authentication algorithm will work. I hope the above clears up the air a little. The table above used information from the "Security Manager Specification" from the Bluetooth Spec ver4.2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As per your suggestion I have set:
sensor (slave): DisplayOnly
clinet (master): KeyboardOnly
This does not work. The bonding process timeouts with SDK 2.2.3. I would suggest you to try it on your own and provide a trace of each client and sensor side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you happen to include the below patches in the makefile of your central?
APP_PATCHES_AND_LIBS += central_role_patches.a
APP_PATCHES_AND_LIBS += additional_gatt_apis.a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I do have those patches in my makefile and it still doesn't work:
#
# Copyright 2015, Broadcom Corporation
# All Rights Reserved.
#
# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
# the contents of this file may not be disclosed to third parties, copied
# or duplicated in any form, in whole or in part, without the prior
# written permission of Broadcom Corporation.
#
########################################################################
# Add Application sources here.
########################################################################
APP_SRC = puart_control.c
APP_SRC += ws_upgrade.c
APP_SRC += ws_upgrade_uart.c
########################################################################
################ DO NOT MODIFY FILE BELOW THIS LINE ####################
########################################################################
# This application requires a special patch for leaking LL connection
APP_PATCHES_AND_LIBS += central_role_patches.a
APP_PATCHES_AND_LIBS += additional_gatt_apis.a
APP_PATCHES_AND_LIBS += bd_addr_control.a
CGS_LIST += $(DIR)/app.cgs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I set up the following on two eval boards:
1) puart_client (keyboard only)
2) hello_sensor (display only, with passkey)
I used clientcontrol.exe to control (1). When I initiate a pairing from (1), it can connect to (2) but will not bond, and will
terminate after 30s. But this is only because (1) does not have a keyboard to enter the passkey.
I used lightblue to initiate pairing with (2), I purposedly did not enter the passkey and the bonding process will
terminate after 30s.
So the above will explain the page timeout (0x04). Unfortunately due to my limitations as I only have eval boards, I
am unable to investigate further. If you are still unable to resolve the issue, please create a support case at the
following URL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for support on this.
In case you connect (1) to (2) you can programatically set the pass key through the lesmp_setSMPassKey(). I believe you don't need a physical keyboard to simulate this.
Btw, the bonding error code 0x01 means timeout, 0x04 is not documented and by reading the forums here it seams it means "not supported".
typedef enum
{
LESMP_PAIRING_RESULT_FAILED,
LESMP_PAIRING_RESULT_TIMEOUT,
LESMP_PAIRING_RESULT_SUCCESS, // this does not include bonding.
LESMP_PAIRING_RESULT_BONDED // this implies pairing succes.
} LESMP_PARING_RESULT;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Marko,
Can you please print all the Management callbacks in both scenarios:
1) Pairing with phone (where bonding is success)
2) Pairing with another eval board (where it fails),
and compare where all do they differ?
Regards,
- Madhu