SPP-over-BLE C example for BGMxxx

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV ‎04-13-2017 09:14 AM - edited ‎04-26-2017 05:10 AM

Introduction

 

This example shows how to implement transparent serial data connection between two BGMxxx modules. Functionally the example is very close to the BGScript example that is described in following article:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/SPP-over-BLE-BGScript-example-for-BGM1...

 

There is no standard SPP service in Bluetooth Smart and therefore we need to implement this as a custom service. The service is exactly same as the one used in the BGScript example (see link above) and it can be described using the XML notation as follows:

 

 

	<!-- Our custom accelerometer service is declared here -->	 
	<!-- UUID values generated with https://www.guidgenerator.com/ --> 
	<service uuid="4880c12c-fdcb-4077-8920-a450d7f9b907" advertise="true">
        <description>SPP Service</description>
        
		<characteristic uuid="fec26ec4-6d71-4442-9f81-55bc21d658d6" id="xgatt_spp_data">
            <description>SPP Data</description>
            <properties write_no_response="true" notify="true" />
			<value variable_length="true" length="20" type="hex"></value>
		</characteristic>
    </service>

 

The basic idea of the SPP service is explained in the BGScript article linked above and therefore it is not covered here.

 

The zip file attached at the end of this article includes source code for one single application that implements both the server and client roles. The role is selected dynamically at power-up using pushbuttons, details are found later in the section Running the demo.  

 

Building the SPP project

 

This example has been tested with Bluetooth SDK 2.3.1 and GCC toolchain. The code should work without any changes at least with the following radio boards:

BGM111 (PCB4300A)
BGM121 (BRD4302A)

 

The zip file attached at the end of this article includes the source files for the C-based SPP example. It is not a complete project but a set of files that you can copy on top of a project created in Simplicity Studio. Follow these step-by-step instructions carefully:

 

Step 1: Create the SOC -Empty example project in Studio

 

After the project is created the BLE GATT Configurator is opened automatically and it shows the GATT database of the project. The project template includes a minimal GATT database that includes three services (Generic Access, Device Information and Silicon Labs OTA). Next you need to add the SPP service using the BLE GATT Configurator.

 

Step 2: add the SPP service

 

The details of the SPP service are:

Service UUID value  4880c12c-fdcb-4077-8920-a450d7f9b907

SPP data : UUID value  fec26ec4-6d71-4442-9f81-55bc21d658d6

 

For the SPP data characteristic, define the ID as “gatt_spp_data”.

The length of the characteristic is set to 20 bytes and type is hex. variable length checkbox selected.

 

Add and enable following properties: write without response and notify.

 

 

The following screenshots show how the SPP service should look like in the BLE GATT Configurator.

 

SPP service:

 

SPP_SERVICE.png

 

SPP_data characteristic:

 

SPP_DATA.png

After adding the service, save the *.isc file and press Generate button on the upper right corner of the GUI.

 

At this point, it is good to check that the project builds without any errors.

 

Step 3: add the C source files to the project

 

Unzip the attached zip file and add the included source files to the project.

 

Files can be added to the project simply by drag&drop. Studio will prompt you to either create a link to these files or create a copy. Select “copy” option. Note that the main.c that was created by Studio as part of the SOC – Empty example is overwritten.

 

Step 4: defined RETARGET_VCOM

 

Finally, in the project settings you need to define the precompiler directive RETARGET_VCOM so that the code uses the on-board USB-to-UART converter of the development kit. 

 

Following screenshot shows how to set this in the GCC build options:

 

RETARGET_VCOM.PNG

 

After building the project, flash the firmware to two development kits. The same application supports both SPP server and client roles. The following section explains how to select the mode.

 

Running the demo

 

Simplest way to run the demo is to use two similar development kits (for example two BGM121 kits). In this case you can use the same binary for both boards.

 

When the application boots, it checks the state of pushbuttons PB0, PB1. If buttons are not pressed the application starts in SPP server role.

 

By keeping either PB0 or PB1 pressed during reboot the application starts in SPP client mode.

 

In server mode, the device advertises the custom SPP service and waits for incoming connections.

 

In client mode, the device starts scanning and searches for the custom SPP UUID in the scan responses. If match is found, the client connects to the target, discovers the SPP service and characteristics and then enables notifications for the SPP_data characteristic. At this point, any data that is input in the client side is sent over the air to the server and printed on the remote UART. Similarly, any data input to the server UART is transmitted back to the client.

 

To connect to the kit using terminal program use the following UART settings: baud rate 115200 , 8N1, no flow control.

 

The example can be also tested between two different kits (e.g. BGM121 and BGM111). As the SPP service is the same that was used in the BGScript SPP example, it is also possible to connect BGScript-based SPP client to C-based SPP server, or vice versa. 

 

Yet another option is to use BLED112 as the SPP client, see following article for more info:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/SPP-client-example-using-BLED112-dongl...

 

 

Power management

 

USART peripheral is not accessible in EM2 sleep mode. For this reason, both the client and the server applications disable sleeping (EM2 mode) temporarily when the SPP mode is active. SPP mode in this context means that the client and server are connected and that the client has enabled notifications for the SPP_data characteristics.

 

When SPP mode is entered, the code calls SLEEP_SleepBlockBegin(sleepEM2) to temporarily disable sleeping. When connection is closed (or client disables notifications) then SLEEP_SleepBlockEnd(sleepEM2) is called to re-enable sleeping.

 

For more details on the power management details, see following article:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/Using-Energy-Modes-with-Bluetooth-Stac...

 

Known issues

 

The sample code uses printf() for sending data to UART. For this reason, the example does not well with binary data transfer. 

 

Conclusion

 

This example is a simple C-based SPP implementation for BGMxxx / EFR32BG products. It is not optimized for performance or low power. The code has been kept as simple as possible.

 

UART input/output is handled using stdio retarget functions (see following article for details:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/Retarget-stdio-to-UART-in-BLE-SDK-2-0-... )

 

This is not the most efficient way to handle UART input/output but the benefit is that it is portable and allows the sample code to be used easily on several radio boards without any modifications.

 

 

 

Comments
by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Riscy00
on ‎04-14-2017 05:40 AM

Hi

 

This is what I'm looking for SPP implementation. 

 

Why there is no SPP in Visual GATT for EFR32BG1 with EVAL Startup Board  PCB4100A Rev 3 ?

 

What needed to make SPP work for this EFR32BG1 device?, I do not like package from BGMxxx series.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎04-14-2017 05:51 AM

This SPP implementation is a custom service I made up just for demo purposes. It is not included in the Visual GATT editor at least for now.

 

The example discussed in this article should work also with PCB4100A without any changes. You first need to create the Soc Empty for this specific board and then add the SPP source files as instructed above.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Riscy00
on ‎04-14-2017 09:59 AM

I have written this code into EFR32BG1 via EVAL board PCB4001 (which should be similar to BTExxx device).

 

I cannot see VCOM appearing in device list in Window Laptop not my android phone.

 

I like to make connection over SPP in bluetooth between Window Laptop or Andoid Phone and this device. What need to be done and how?

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Star</font></font> </a> MarcinB
on ‎04-18-2017 07:06 AM

You should see device like JLink CDC Uart Driver in Device Manager (COMx), and this is the correct COM device to conect in this example. But this is GATT service not real SPP profile so you will not see any extra COM ports. 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎04-20-2017 03:40 AM

Hi

I found C_BASED_SPP_EXAMPLE very useful. I'd like to know which pheripheral must be enabled (RTC must be enabled for example?)because in the zip file there is no InitDevice.c file. 

Best Regards

Giovanni

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎04-20-2017 03:51 AM

@Gio63 if you create the Soc Empty example for your target radio board in Studio you will get the InitDevice.c file that is suitable for that board.

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎04-21-2017 02:42 AM

Thank you JaakkoV. Just another question......I need to send data received from SPP client through UART but I need to send binary data as well so I think printf can't work. I thought to modify file spp_server_main.c (inside C_BASED_SPP_EXAMPLE) because my application behave only as a server in this way:

 

  switch (BGLIB_MSG_ID(evt->header)) {

                 .....

                ........

                  ......

                case gecko_evt_gatt_server_attribute_value_id:
               {

                          memcpy(printbuf, evt->data.evt_gatt_server_attribute_value.value.data, evt->data.evt_gatt_server_attribute_value.value.len);
                          TxBuf(printfbuf, evt->data.evt_gatt_server_attribute_value.value.len);


               } 

                 ......

 }

 

 int TxBuf(uint8_t *buffer, int nbytes)
{
 int i;

 for (i = 0; i < nbytes; i++)
 {
    RETARGET_WriteChar(*buffer++);
  }
  return nbytes;
}

Do you think could it work? Thank you

Giovanni

 

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎04-26-2017 05:15 AM

@Gio63 the solution that you proposed looks good to me. You don't necessarily need to use memcpy to first copy the bytes into another buffer. You could simply just have one function call:

 

TxBuf(evt->data.evt_gatt_server_attribute_value.value.data, evt->data.evt_gatt_server_attribute_value.value.len);
by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎04-26-2017 09:07 AM

Thank you Jaakkov. In the file ssp_server_main.c I don't find any call to API Function "gecko_cmd_le_gap_set_adv_parameters" There is any reason ?

Thank you

Best Regards

Giovanni

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎04-26-2017 09:16 AM

The example uses default advertising parameters. You can add a call to gecko_cmd_le_gap_set_adv_parameters before starting advertisements if you want to use some other settings.

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎04-27-2017 02:31 AM

Thank you Jaakkov. From the point of view of server side if a server want to close a connection it  need to call  the API function  "gecko_cmd_endpoint_close". Is it correct?

Thank you

Best Regards

Giovanni

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎04-27-2017 02:34 AM

Yes, endpoint close can be used to close connection either by server or client. 

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎05-08-2017 06:07 AM

Hi 

I have a problem with serial RX Interrupt. After connection with server the rx interrupt of client module has problems. The interrupt dosn't alway trigger. I set a breakpoint in the interrupt routine but the program counter doesn't go there every time a serial character is received from serial line

Do you know the reason ?
Best Regard

Giovanni

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎05-08-2017 07:46 AM

@Gio63 no, unfortunately can't tell the reason for that. Is that with the original example code provided in this article or some modified version of yours? In the latter case, I suggest that you start a new topic on the forum and add your code as attachment,

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎05-08-2017 09:30 AM

Hi

I solved the problem I forgot to call the routine "SLEEP_SleepBlockBegin(sleepEM2)" and I use UART1 so I can't go to EM2. 

I'd like to know if it possible to go into EM1 mode instead of going into EM2 mode when bluetooth is working. In my application I use a small battery so I have to save a lot of energy

Thank you

Giovanni

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎05-08-2017 11:07 AM

SLEEP_SleepBlockBegin(sleepEM2) means that the device is not allowed to enter EM2 (or deeper) sleep modes, but it will still enter EM1 whenever possible.

 

If you want to save power, one possibility would be to use a GPIO input to enable/disable sleep whenever needed. Kind of a "wakeup pin", just like the one that is used in NCP mode designs. (See https://www.silabs.com/documents/login/user-guides/UG119-BlueGecko-BT-Device-Config.pdf and section 3.2 <wake_up> for more info).

 

Another possibility could be to use LEUART that is accessible also in EM2.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎05-12-2017 07:17 AM

Hi

I can't use LEUART because I need of IRDA interface so I must use UART. I'd like to know if  is present the flags" .sleep.flags=SLEEP_FLAGS_DEEP_SLEEP_ENABLE,2" IN  Gecko configuration parameters  after calling the function SLEEP_SleepBlockBegin(sleepEM2) does the bluetooth protocol enter in EM1 mode?

Thank You

Best Regards

Giovanni

 

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎05-12-2017 11:09 AM

>> I'd like to know if  is present the flags" .sleep.flags=SLEEP_FLAGS_DEEP_SLEEP_ENABLE," IN  

>> Gecko configuration parameters  after calling the function SLEEP_SleepBlockBegin(sleepEM2)

>> does the bluetooth protocol enter in EM1 mode?

 

Yes, in this case stack enters EM1 whenever possible.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Gio63
on ‎05-13-2017 05:42 AM

Thank you. Yes the flag SLEEP_FLAGS_DEEP_SLEEP_ENABLE is present after callingSLEEP_SleepBlockBegin(sleepEM2) and do I think stacks enter EM1 mode when possible . Another question.....Can I wake up module from EM2 with an input pin for example with UART Serial RX pin? If it possible I could avoid to call SLEEP_sleepBlockBegin function and micro could enter in EM2 mode.

Thank  you

Best Regards

 

Giovanni 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎05-13-2017 06:06 AM

It's not possible to wake up on UART RX pin. You can use a separate wakeup pin but it can't be one of the UART pins.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Claus_HY
on ‎05-19-2017 03:42 AM

after following you instructions I see on terra term as follows:

þDISCONNECTED!connectedConn.parameters: interval 200 units, txsize 27
þDISCONNECTED!connectedConn.parameters: interval 200 units, txsize 27
þDISCONNECTED!s: interval 200 units, txsize 128

and on the other side

Found SPP device
Empty Exconnected
Conn.parameters: interval 200 units, txsize 27
service discovered
Conn.parameters: interval 200 units, txsize 128
SPP char not found?
DISCONNECTED!

this will be repeats more than one time and then it stops.

I used the BGM113.

Maybe some Settings are missed?

I have got no static connection between the modules.

 

thx

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎05-19-2017 04:25 AM

The connection is dropped by the SPP client because it can't find the SPP_data characteristic in the remote database:

 

SPP char not found?

 

Please check the SPP_data characteristic definition. Possibly a mistake in the UUID value? 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> Claus_HY
on ‎05-19-2017 06:47 AM

Copy paste error, now it works..

thx

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Genius</font></font> </a> ps_eddy
on ‎06-06-2017 05:53 AM

Hi JaakkoV,

 

is there any way to run the SPP over BLE without relying on the Retargetserial? I've been trying for quite a while on reading the incoming data (read hex) from send_spp_data() without using the RETARGET_ReadChar(). However, modifying the RETARGET_ReadChar() into USART1->RXDATA makes my SPP program unable to read or write anyting at all.  Thank you.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Star</font></font> </a> Uriel
on ‎06-06-2017 04:09 PM

Hi JaakkoV,
I am using the BGM113 module and I want to use the PC10 (TX) and PC11 (Rx) pins for serial communication, as I make the modifications to the code the original code only allows me to select RETARGET_VCOM or RETARGET_USART0 (PA0 PA1).

 

I also need to use the module to connect to a mobile phone with a serial console application, is it possible to do this? That I have to modify in the code to be linked with the mobile phone

regards

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> aureliusss
on ‎07-24-2017 02:44 AM

Hi JaakkoV,

is there any specific reason for disabling SPI communication on USART1? Becouse i'd need it in the final design of my project.

Thanks

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎07-24-2017 08:16 AM

@aureliusss no, there is no specific reason for that. USART1 is used in the beginning to put the SPI flash memory into deep sleep and then USART1 is de-initialized to make sure it is not drawing any extra current. This code is inherited from the SoC Empty template and it is nothing specific to the SPP example. If you need to use USART1 for something else then you can reconfigure it as needed.

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Super Star</font></font> </a> finalfantacypro
on ‎07-26-2017 05:04 AM

Hi JaakkoV,

 

I use this to communicate with my own android application. it works and I have some issues.I use BleuGecko121 as a server.  

 

1. My Blue Gecko connects automatically with something, every time, I have to do a reset to make it connect to my phone.

 

2. I can't send more than 20 octets to my BlueGecko. is there any way in android the client side to send packets like you did in BGM121   

 

Thanks

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Star</font></font> </a> Froboz
on ‎07-27-2017 11:40 AM

 I'm confused how this is working if the USART is not even set up under the .hwconf file.  The Usarts (USART0, USART1) don't even appear to be initialized.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Star</font></font> </a> Froboz
on ‎07-27-2017 12:35 PM

OK, I understand.   You initialized manually for some reason, so that the configurator was bypassed.  Hence the Retarget statement

 

by Aersean
on ‎08-03-2017 03:17 AM

Hello JaakkoV,

Thanks your C code! I am a beginner for this. Now my compiler is studio-v4 and dev-board is SLWSTK6101B with BGM111. I made this demo base on your guidance. When I built this project, the compiler told me cann't found retargetserialconfig.h file, and some macros (BSP_GPIO_PB0_PORT ...) are undefine. So I think I maybe lost same main point. Could you give me some help?  THX!!!

Best regards,

Aersean

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎08-14-2017 08:09 AM

Hello @Aersean,

 

sorry for the late reply, just came back from summer holiday.

 

Did you start by creating the SoC Empty example project for BGM111? In that skeleton project all the include paths should be set correctly so that retargetserialconfig.h file is found. If you are using the latest BLE SDK (v2.4.1 at the moment) then those files are located in C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\hardware\kit\common\drivers\

 

BSP_GPIO_PB0_PORT and other macros are defined in file bspconfig.h that is located in C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v1.1\hardware\kit\EFR32BG1_BRD****\config\

 

 

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> roinovi
on ‎08-24-2017 03:58 AM
Does this app support multibond?
Meaning i want to have one client and several servers
by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎08-24-2017 04:42 AM

>>Does this app support multibond?
>>Meaning i want to have one client and several servers

 

No, this sample application is written to support only single connection between one client and one server. 

 

The client code can be modified to connect to multiple servers. After establishing one SPP connection (reaching the DATA_MODE state in the client state machine) you can start the discovery again, connect to a second SPP server etc...

 

If you want to support multiple simultaneous connections then you may find this example useful:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/Multi-Slave-Multi-Master-Dual-Topology...

 

 

by Aersean
on ‎08-25-2017 01:55 AM

Hello JaakkoV,

 

Thank you, I will try it.

 

Best regards,

Aersean

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> roinovi
on ‎08-27-2017 01:19 PM
Tnx
This helps
But i wanted to know if in this example the server can connect to several clients, not simultaneously
Meaning the server will pair with one client, after that the client will shut down, and the server will pair with another client, so the server will have a list of bonded client
by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> JaakkoV
on ‎08-27-2017 02:50 PM

@roinovi the spp_server example does support sequential connections from multiple slaves. After one connection is closed, the server will automatically return to advetising mode so that a new connection can be opened (either by the same client or a different client).

 

If you want some sort of access control (for example, bonding is required) then that needs to be added by yourself.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> roinovi
on ‎09-10-2017 02:57 PM

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 <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> 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 <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> 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 <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Legend Employee</font></font> </a> 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.