Evaluating SPP-over-BLE example using BLE1xx cable replacement app
10/285/2016 | 07:45 AM
This article shows how to evaluate the SPP-over-BLE BGScript example for BGM111 with the BLE1xx cable replacement app for iOS. The original example requires using 2 SLWSTK6101A but the server side project can be slightly modified so that it can be used with the iOS app as a client.
The app is compatible with the cable_replacement example (attached here as reference) from the BLExx SDK (commonly called legacy BLE) so the service UUIDs used in that example must be used in the SPP-over-BLE example as well. Attached is the server side project for BGM1xx with the required modifications in the GATT file to match the cable_replacement example:
1- UUID for SPP Service copied from cable_replacement example
2- UUID for SPP Data characteristic copied from cable_replacement example
3- SPP Data properties changed from write_no_response="true" to write="true"
Modifications (1) and (2) allow the iOS app to discover and show the device in the scan list and to discover the cable replacement service. Modification (3) is because the app is using WriteWithResponse to write data into the GATT. Using write instead of write_no_response decreases throughput but this app is not an optimal way to measure throughput so there is minimal impact. If you wish to develop your own app to measure the throughput then you can change the property back to write="true" and use WriteWithoutResponse on the app side. On this particular app you can find the call in the CRViewController.m file in the source code.
Running the Projects
The BGM111 project can be built and flashed with BGTool which can be launched from within Simplicity Studio or directly from the bgtool.exe executable located in C:\SiliconLabs\SimplicityStudio\v4\developer\stacks\ble\v22.214.171.124\protocol\bluetooth_2.0\bin
The iOS app is only available as source code so you need a MAC and Xcode to build and load the app to your iPhone or iPad.
Once both the BGM111 and the iOS device have their respective software you can open a terminal emulator to talk to BGM111 using baud 115200, 8N1 and no flow-control. To ensure that the connection is properly established you can reset the BGM111 after which you should see the message below (build number might be different if you're using a different SDK version).
Then you can open the iOS app and enable the scanner so that BGM111 SPP server becomes visible in the device list.
After selecting device it will discover the "BG Cable Replacement" service.
After selecting the service you will be able to exchange raw data with the BGM111. Data written in the terminal emulator will show up in the iOS app and vice-versa.