Reply
Posts: 80
Registered: ‎08-20-2016

spp server phone bonding

hello

i want to use the "spp over ble c based" example running on a BG which is connected to my custome board.

my board would stream data to a phone app i am developing.

in order to make the bonding part in the app developing as minimal and fast as possible (and generic)

i want the phone app to be able to pair and bond using the phone's BT menu (system->bluetooth->etc) .   

please see below my discussion with  JaakkoV

when i try to connect to the "spp server" i get this in the terminal:

 

* SPP server mode *<CR><LF>
connected<CR><LF>
Conn.parameters: interval 39 units, txsize 27<CR><LF>
bonding failed<CR><LF>
DISCONNECTED!<CR><LF>

 

 

 

 

 

 

 

hello

in my application, i want to pair my device using a standart profile (e.g HeartRate) instead of the custome one provided in this example,

because i want my phone app to be able to pair manually ->using the standart ble phone pairing (from "settings"->"bluetooth" etc)

i was trying to switch the profile in the ble gatt configurator from the " custome BLE GATT" to a Heart rate profile but was unable to delete the custome BLE GATT

 

whats the best way for me to do that?

 

i want to do this because i am developing my own phone app and dont want to waste time developing pairing to a custome gatt profile.

 

tnx

 
 
 
 
 
 
 
 
by  JaakkoV
on ‎09-11-2017 01:22 AM

@roinovi when you talk about pairing what do you actually mean? Is it enough to establish a connection between the devices or do you want the devices to be bonded?

 

I don't see how the pairing/bonding is related to the services included in GATT database of the server. I tested with Android phone that I can bond with a device runing the SPP example, using the manual procedure from the Bluetooth settings. Are you working with Android or iPhone? If you're using an iOS device then I would not be surprised if it hides those devices that do not expose any standard service (such as Heart Rate).

 

Please give some more details so we can figure out what is the best solution in your case.

 
 
 
 
 
 
 
 
by  roinovi
on ‎09-12-2017 05:08 AM
I want the devices to bond
I tried discovering both on ios and androi (samsung tablet) but the spp server didnt show.
Wgat i want the obdo is to develop a phone app and in regards to the bonding procces, i want the developing to be minimal.
So i thought to use a sig profile in the spp server and to bond the phone and server using the manual procces via the phone bt
U said you were able to bond your android device to the spp server using the spp profile?
I tried with another lg phone and was able to begine the pairing procces but the connection was immediately dropped
How should I proceed?
 
 
 
 
 
 
 
 
by  JaakkoV
on ‎09-12-2017 05:30 AM

I would suggest that you try to initiate the bonding from your smartphone app as follows:

 

1) in the peripheral side, make sure that there is at least one characteristic in the GATT with the bonded_read property set to true

2) after your application connects to the periheral, read the characteristic with bonded_read property

3) if the bonding does not exist, the smartphone OS should initiate bonding automatically

 

On the peripheral side, you can monitor the event evt_le_connection_parameters to check what is the security level of current connection. This event includes parameter security_mode, for more details see BGAPI reference manual.

 

If you can't get this working, please create a new topic in the forum and provide as much detail as possible. This issue is not direclty related to the SPP-over-BLE example so it should be discussed in a separate topic, not under this KBA.

Highlighted
Posts: 2,674
Registered: ‎09-01-2015

Re: spp server phone bonding

Can you list what commands you are using to configure the security manager?

(sm_configure, sm_set_bondable_mode,...)

 

When you get the bonding failed event you can print the reason code to console, it may be helpful in figuring out what is the problem.

 

case gecko_evt_sm_bonding_failed_id:
  printf("bonding failed, code: 0x%x\r\n", evt->data.evt_sm_bonding_failed.reason); 
break;
Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

hi

i get :

* SPP server mode *<CR><LF>
connected<CR><LF>
Conn.parameters: interval 39 units, txsize 27<CR><LF>
bonding failed, code: 0x303<CR><LF>
DISCONNECTED!<CR><LF>

 

where is the list of the error codes?

what does 303 means?

 

here is the list of the security commands (didnt change anything from the original spp example with security)

 

 

 

case gecko_evt_system_boot_id:

reset_variables();

gecko_cmd_sm_configure(0x0F, sm_io_capability_displayyesno);
gecko_cmd_sm_set_bondable_mode(1);

gecko_cmd_le_gap_set_mode(le_gap_general_discoverable, le_gap_undirected_connectable);
break;

Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

i have tried connecting 2 spp servers to a generic ble finder app on an iphone and it bonded successfully

however, on the android tablet i tried bonding from a generic ble app and from the settings menu and both failed. 

Posts: 2,674
Registered: ‎09-01-2015

Re: spp server phone bonding

The error codes are listed in BGAPI reference manual. You can find this doc in Simplicity Studio. Or you can try the online doc library, https://www.silabs.com/support/resources

 

Here's a direct link to the doc:

https://www.silabs.com/documents/login/reference-manuals/BluetoothSmart_APIRefMan.pdf

 

Error code 0x0303: 

authentication_requirements - "The pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices"

 

Posts: 2,674
Registered: ‎09-01-2015

Re: spp server phone bonding

You initialize the security manager as follows:

 

gecko_cmd_sm_configure(0x0F, sm_io_capability_displayyesno);

 

The first parameter is a bitmask that turns certain features on/off. Bit 2 meaning:

• 0: Allow bonding with legacy pairing

• 1: Secure connections only

 

(for full details, see the API manual mentioned in my previous post)

 

The LE Secure Connections is a BT 4.2 feature. Possibly your Android tablet does not support this feature and therefore the bonding fails. Try allowing legacy pairing (BT 4.0) and see if you can bond with the tablet.

 

gecko_cmd_sm_configure(0x0B, sm_io_capability_displayyesno);

 

(first param changed from 0x0F to 0x0B)

Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

hi

i tried with 2 samsung tablets and i do get a window for entering a passkey (the passkey that is generated and shown in the terminal)

however when i type in the passkey and hit ok, after a few seconds i get in the terminal  " bonding failed, code: 0x185"

which means that it times out.

what could be the problem? 

Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

i just checked and the tablets are 4.0 so i guess thats the problem

because the bgm 111 is 4.2.

i will check with different android and let you know.

 

however, when i tried to connect to an iphone several times, i succeded several times but then i started to get : bonding failed, code: 0x308 

and even after i erased the bgm from the flash programmer and reflashed the bgm i still got this error.

does it have a maximum bonding connections?

how can i reset it?

Posts: 2,674
Registered: ‎09-01-2015

Re: spp server phone bonding

Erasing the flash removes all bonding information. One possible reason for the 0x308 error could be that you have removed the bonding from the BGM111 but not from the phone. The bonding must be erased from both the phone and the BGM111.

 

 

Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

i deleted the bonding from the phone and it works.

you were right.

what about the compliance between 4.0 and 4.2?

i saw that version 4.0 and 4.2 should be compliant so why does the samsung tablets (which has BT 4.0) cant bond with the bgm111?

even when i did the legacy pairing with the right bitmask

Posts: 2,674
Registered: ‎09-01-2015

Re: spp server phone bonding

BT 4.2 is backwards compatible with 4.0 so in theory it should be possible to bond your 4.0 tablet with the BGM111. However, in practice there can interoperability issues with some specific phone or tablet versions (and also some Android / iOS versions).

 

What is the exact model and OS version of the tablet you are testing with?

Posts: 80
Registered: ‎08-20-2016

Re: spp server phone bonding

attached

if i reduce security, should it matter?