RoadTest: Silicon Labs Bluetooth Design Kit
Author: aswinvenu
Creation date:
Evaluation Type: Development Boards & Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Bluetooth low energy market is pretty competitive. Here are few mentions:- Nordic's nRF52 series, ST Microelectronics Blue NRG-2 and, TI's SimpleLink products, Cypress EZ-BLE WICED modules etc are comparable with Silicon Labs offering. All the 8 bit micro controllers from Atmel/MIcrochip, TI etc are comparable with the silicon labs 8 bit MCU offerings.
What were the biggest problems encountered?: Installing eclipse plugins some times gives a headache. I got it right after couple of iterations.
Detailed Review:
The BGX13P creates a Bluetooth 5 compliant BLE cable replacement interface, facilitating a BLE link to a second embedded device ora mobile device.
An embedded MCU controls the device and communicates across the BLE link through a serial interface and controlsignals. Parameters stored in non-volatile
memory and configurable through the serial interface adjust performance characteristics of the device.
Overall dimension of the module: 2.9 ×15.0 × 2.0 mm (W × L × H)
package dimension : 6.5 mm x 6.5 mm x 1.4 mm
BGX13P module is a 31 pin packaging. Out of the 31, 12 pins are no connection and 5 pins are power pins (including 4 GND pins).
BGX13P requires only a single power rail for operation. Which is Pin 29 VDD.
For a typical application one can follow the below mentioned diagram
In this case the Host CPU can be any micro-controller. MCU communicates to BGX using 8N1 UART bus (8 data bits, No parity bits and 1 stop bit) with flow control(CTS - Clear to Send and RTS - Requests To Send).
If your solution has pin constraints then you can turn off the flow control. But its always preferred to have flow control on.
As mentioned above VDD is the only main power required for the whole module. The ratings are given below.
BOOT is an optional pin. It's an active low pin. If you tie the pin to low then it will force the module to boot into the DFU boot loader mode after reset. Boot can left not connected.
Internally this pin is pulled high.
Reset pin can be driven from a MCU GPIO. Reset is an active low pin.
Module can be reset in 3 different ways:
* By pulling the reset pin low (reset button provided in the BGX board does this )
* Using Internal Watchdog timer ( Expiring the watch dog timer can trigger reset)
* Using Serial command (This option we will cover later this article )
GPIO0 and GPIO1 used for LED0 and LED1 respectively.
GPIO2 and GPIO3 used for Switch0 and switch1 respectively.
BGX13P hosts the Complete Bluetooth5 compatible stack inside the module ( Bluetooth5 is backward compatible with Bluetooth4.2. I will call it as Blueetooth Low Energy or BLE). The BLE ( Bluetooth Low Energy) connection parameters can be written to the internal non volatile memory through a set of commands.
These commands can be sent either through the Serial bus or from a remote mobile app using the BLE connection.
Since the whole Bluetooth5 compatible stack is hosted inside the module the host MCU doesn't need to worry much about the heavy lifting of the BLE stack. MCUs or Any Serially connected device can communicate to the
BGX13P module using a set of commands.
BGX13P has 3 main mode of operations.
Lets take a look at these in detail
As I mentioned earlier the BGX13P hosts the Bluetooth5 compatible stack inside. So any update to the BLE parameters should happen through a set of commands. Silicon labs has defined a set of commands to communicates to the BGX Module.
Example:
"adv" for advertise in peripheral mode.
"get" and "set" for getting and setting the internal variables respectively.
"scan" for scanning the nearby peripherals ( In Central Mode)
"con" for connecting to a peripheral (In Central Mode)
Full list of commands will be found here: https://docs.silabs.com/bgx/latest/cmd/commands
When the Local COMMAND mode is selected, commands can be passed from the host MCU though UART. This will be parsed and executed by BGX13P module. Each command should be followed by a CR ( "\n") character.
Local COMMAND mode can be enabled by sending a breakout command ("$$$" or "-breakout $$$") from streaming mode. (Note: If you care in streaming mode breakout command should be send without CR "\n") or
by setting up the str_select variable. "str_select" variable will help users to select GPIO functions to enter and exit from these modes.
In stream mode there is no connection to BGX13 command parser. Whatever character you send from the host device will straight away goes to air.
Send a breakout command ( a special command compared to other commands) to exit from this mode to command mode.
Remote COMMAND mode is similar to Local COMMAND modes. All the commands are valid here. But the commands are send from a BLE connected device which utilizes the BGX Xpress Streaming Service.
The above mentioned modes can be selected using two methods.
In Automatic Mode selection:
Upon boot module goes to Local COMMAND mode. Enter streaming mode by sending command "str". Issue Breakout command to jump to COMMAND mode again.
If a BLE device is connected and mode characteristic is changed then modes can be changed from STREAM mode to COMMAND mode and back.
In Manual Mode selection:
command ( For boot with COMMAND mode )
stream ( For boot with STREAM mode )
mode_sel
GPIO
I was mentioning about setting and getting variables in the previous sections. Lets look at what are the variables available in BGX13P.
To control somewhat complicated BLE stack, few commands are not enough. Commands covers most part of the operation, But each operation needs more information to perform.
For example lets take Bluetooth Advertising: Bluetooth stack provides options to manage advertising like what is the interval of advertising and what are the parameters passed while advertising. Is it a connectable advertise etc.
To set all these parameters BGX13P uses variables.
There are 45 variables available for you to tweak. They are categorized into:
Full list and details of variables are found here: https://docs.silabs.com/bgx/latest/cmd/variables#sy-i-s
The BGX13P family facilitates two types of BLE communication links:
In the BGX-to-mobile communication use case, the BGX13P operates as a peripheral that is discoverable and connectable when con-figured to that state through either
the command API or the pin states driven by the embedded MCU. Using the Xpress mobile library,mobile applications can scan for BGX13P devices, connect,
and communicate with the device in both streaming and remote command modes, where the mobile app can execute command API functions remotely.
In the BGX-to-BGX communication use case, one BGX13P must be configured as the central and one or more other BGX devices should be configured as a peripheral.
Devices can be configured at runtime through the command API, or those settings can be savedto non-volatile memory so that each device wakes from power-on or
low power states as either a peripheral or central.
Enough of theory Lets get into some hands-on:
Requirements:
Installing Simplicity Studio:
As the first step of the development and testing lets install the recommended IDE for any silicon labs products. It's called Simplicity Studio. ( Note: I am using Ubuntu 18.04 Linux as my development PC, So all the steps described here are for Linux setup. MAC users will have almost similar steps. Windows users may have to refer to the manual)
Simplicity studio is the Integrated development Environment for Silicon Labs products. Simplicity Studio simplifies the IoT development process with one-click access to everything developers need to
complete their projects using an integrated development environment (IDE) based on Eclipse 4.5. Simplicity Studio includes a powerful suite of tools for energy profiling, configuration and wireless
network analysis, as well as demos, software examples, complete documentation, technical support and community forums.
Step 1 :
Get the latest version of Simplicity Studio from here : https://www.silabs.com/products/development-tools/software/simplicity-studio
Select the appropriate one for your working environment.
Step 2:
Download and extract the file.
tar xvf Downloads/SimplicityStudio-v4.tgz
Step 3:
Read the Readme.txt file before you proceed with anything. Okay it recommends you to update and upgrade the packages
sudo apt-get update sudo apt-get upgrade
Execute the setup shell script
sudo ./setup.sh
Note: Use sudo ( super user do )
Wait for few minutes until the installation gets done.
Step 4:
Before you proceed with running the studio. I would recommend you to make sure that you have wine (windows environment for Linux systems) installed in your system. For those who don't have wine in your system please follow the lines.
sudo dpkg --add-architecture i386 wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport sudo apt update sudo apt install --install-recommends winehq-stable
Step 5:
Run run_studio.sh script to start the studio.
An eclipse based IDE will open up. Bingo!.
But you are only half way done. We need to install additional packages to use it for any development.
Step6:
Install all the additional software packages required.
This RoadTest kit has came with EFM8 evaluation board. So we need to install supporting SDK for that as well.
For that select install by product group.
Select EFM8 and related software packages.
This is roughly around 4.5GB of download and 12GB of install. So take a break and have a coffee!
Once everything is done the IDE will ask for a restart.
We are almost there!
After the reboot install the Xpress Configurator for communicating with BGX13P breakout board though usb cable.
Connect your BGX13P board to the computer using a microUSB cable (The cable provided in the package or any).
The device will be automatically get detected by Simplicity studio. Confirm it by going to Debug Adapters option.
Click on that and go to the Launcher widnow. You will see Xpress Configurator listed there.
Click on that and install it.
Okay now we are all set from the simplicity studio IDE point.
Now install the BGXCommander in your mobile app. (I am using an android phone. So I have to go to App store and install it)
If your BGX13P module is powered it will start advertising in the BLE peripheral mode and It will be visible in the Commander landing page. Connect to the device and go ahead with a firmware upgrade. ( The firmware inside your BGX13P will be obsolete and It should be upgraded to the latest one)
Now we are all set for testing some functionalities.
Connect the BGX13P Board to your computer using the micro USB cable.
Open Simplicity Studio and make sure that the board is detected in Debug Adapters section.
Open XpressConfigurator and press the connect button in the bottom and select the BGX13P module.
The board automatically goes into the COMMAND mode by default. Now we can test the commands here.
Lets start with "ver", This the command to get the version of the firmware inside the module.
Lets look at some of the GPIO commands.
GFU stands for GPIO function.
• For GPIO 2’s BTN0: gfu 2 str_select
• For GPIO 3’s BTN1: gfu 3 str_select
•For GPIO 0’s LED0: gfu 0 con_status_led
• For GPIO 1’s LED1: gfu 1 con_status_led
• For GPIO 0’s LED0: gfu 0 str_activity_led
• For GPIO 1’s LED1: gfu 1 str_activity_led
You will see the orange LED0 blinks.
To access the GPIOs first you need to set the GPIO of interest to stdio mode.
For example:
SWITCH1 is connected to GPIO2 to control this you need to send command
gfu 2 stdio
Configure the pin as input.
gdi 2 in
Now press the switch and read the value in the GPIO2
Similarly you can do for all the GPIOs. Lets look at the LED0 example
To toggle LED0. First deinitialize the GPIO from other modes. by assigning none. Then select it as a stdio pin, then set the direction as ouput with active high. Then control the GPIO values.
gfu 0 none gfu 0 stdio gdi 0 ohi gse 0 0 gse 0 1
Now lets get the BGX13P module to advertise mode (So that other BLE central apps can see them)
send adv command.
Now open the BGXCommander app in your smart phone and press can button.
You will see the BGX13P module getting discovered by your smart phone. Click on that and it will take you to the dashboard with two radio buttons and a terminal.
Make sure that your BGX13P module is connected to the BGXCommander app.
Now there are two ways of entering into streaming mode.
Once you are in streaming mode then you can send messages back and forth from the module to connected app and vise versa.
To exit from the STREAM mode to COMMAND mode, you need to send a breakout command.
This is by sending $$$ or -breakout $$$
Note: The way BGX Configurator sends the strings is with "\n" character. So even if you send $$$ or -breakout $$$ module is not going to exit from the STREAM mode.
To solve this issue BGX Configurator gives an additional option for sending a breakout string ( without trailing "\n" character)
remote COMMAND mode is selected from the connected BGXCommander app.
You can execute pretty much everything we tried on the serial command option.
For this RoadTest I have provided with an EFM8 universal bee board to test the BGX13P module. Things get more handy when the host MCU and Module are from the same vendors.
We already discussed how to setup the Simplicity studio and installed all the required SDKs for EFM8 development mode.
EFM8 is an 8051 based 8 bit micro controller from Silicon Labs.
Featuring:
Power-up the board using micro USB cable and use USB mini for connecting the onboard segger debugger to your computer.
Open the Simplicity Studio and check your EFM8 Universal bee got detected in the Debug Adapters menu.
Once you click on the debug adapter, It will load all the demos, example projects and documentation required for the particular board (In this case for EFM8 universal Bee)
For testing BGX13P we need to select BGX option from the demos.
Load the sample project.
This project uses the onboard LCD and switches for selecting BLE modes from peripheral to central. Since I don't have another BGX board I cant really try the Central mode. So I will test the peripheral mode example.
Again in peripheral mode we will test both streaming back and forth from the app and device.
Lets look at the code briefly.
main function
void main(void) { // Initialize the device enter_DefaultMode_from_RESET(); // Board controller disconnected from EFM8 UART pins BSP_BC_EN = BSP_BC_DISCONNECTED; // Initializes the UART1 peripheral STK_DEMO_UART1_init(); // Resets the BGX board and initializes it's baud rates and GPIOs BGX_init(); // Initialize the commands and stream text used for TX STK_TX_init(); // Initializes demo mode 1) CENTRAL 2) PERIPHERAL STK_DEMO_initMode(); // Initialize LCD Screen STK_DISPLAY_init(); // Clears and resets the buffers and targets Buffer A STK_RX_init(); // Enable all interrupts IE_EA = 1; // Mainloop while (true) { STK_RX_handleRx(); STK_TX_handleTx(); PWR_enterIdle(); } }
After the board initialization. BGX init starts.
void BGX_init() { BGX_reset(); BGX_setModePin(); BGX_setConnectionPin(); BGX_save(); STK_RX_init(); BGX_getDeviceName(); BGX_disableAdvertising(); }
The board gets reset and GPIO6 is set as the MODE select Pin by sending the following commands.
void BGX_setModePin() { Wait(1000); BGX_sendCommand("gfu 6 none"); Wait(500); BGX_sendCommand("gfu 6 str_active_n"); }
save the new configuration by sending save command.
set the Device Name and disable the BGX from advertising.
All BGX Commands are sent with the trailing "\r\0"
void BGX_sendCommand(char* command) { DECL_PAGE; strcpy(commandBuffer, command); strcat(commandBuffer, "\r\0"); SET_PAGE(UART1_SFR_PAGE); IE_EA = 0; UART1_writeBuffer(commandBuffer, strlen(commandBuffer)); IE_EA = 1; RESTORE_PAGE; }
There are two modes for the demo either in Peripheral or in Central mode, This you can select using PB0 or PB1 ( PB : Push button) Respectively.
Once you enter into say peripheral mode. You can press the switched to send predefined string to a connected device.
Debug the code and run it on the EFM8 universal bee platform.
Once the device starts executing, You get options for choosing between central and peripheral mode in the LCD.
Press PB0 to proceed with peripheral mode.
Now your BGX will start advertising. Open the BGXCommander app and connect to the BGX board.
press the push button on the EFM8 board to send some strings to the app.
For those who develop mobile application should have a good understanding of how the BGX BLE profile works. To understand the BLE profile I am using Nordic Connect app and connect the BGX to it while module is advertising.
Apart from the mandatory GATT and GAP services
It has got
Device information service is a standard SIG defined service to hold device specific information.
Unknown service 1 331a36f5-2459-45ea-9d95-6142f0c4b307 is used for sending RX and TX information as well as
changing the mode from streaming to remote command.
More information will be found here: https://docs.silabs.com/gecko-os/1/bgx/latest/ble-services#xpress-streaming-service
I couldn't find much information about Unknown service 2.
Note: This should be one of the interesting part of the testing. But unfortunately due to COVID19 pandemic I don't have access to any good measurement tools. So mostly I will be doing datasheet analysis with onboard AEM ( Advanced Energy Meter )
Power consumption in the BLE IOT market is a hot topic. Different chipset/SOC vendors are putting their great effort to reach the lowest possible energy consumption.
I would say SiliconLab's BGX13P may not be the lowest power consuming device out in the market. But they got the values neck to neck with the competitors.
Active supply supply current of ~3uAmps with a baud rate of 9600 is really impressive. At 20milli seconds advertising interval the chip is drawing 2mA and 4.7 mA if the baud rate is greater than 9600.
BGX13P is a single supply device and when you connect it to the EXP header of EFM8 it will be powered using EFM8's VMCU. There is an energy meter available on board of EFM8. Any peripheral which drains current from VMCU can be monitored using
Energy Profiler available in Simplicity Studio.
Connect the USB mini debugging chord to the computer. And run simplicity studio. Open Energy perspective in simplicity studio.
Toggle the switch to AEM position.
Now select peripheral mode from the example program.
Run energy profiler by selecting the JLink debug adapter and start a new energy capture.
The whole example project is consuming 6.90mA of current while in advertising mode ( This includes all the peripherals connected to EFM Board (LCD mainly).
But if you look at delta from 6.18mAmps base line( 550mseconds) to roughly around 29 mAmps (for burst of 3.6mSeconds) when the radio active. The average comes around 6.32mAmps which is ~140uAmps while advertising around 550msec interval. That's actually an impressive number.
The below image is captured while receiving 50characters ( 51 with "\n") from the app to device.
BGX13P is an easy to integrate, low power, out of the box Blueetooth5 solution for those who are looking for adding BLE wireless feature to their embedded solution.
The tools that that Silicon Labs provided are really good and everything is very well documented.
Some cons are:
Datasheet for BGX13p : https://www.silabs.com/documents/public/data-sheets/bgx13p-datasheet.pdf
Wireless Xpress BGX13P user guide : https://www.silabs.com/documents/public/user-guides/ug369-slexp8027a-bgx13p-user-guide.pdf
BGX13 Command Reference : https://docs.silabs.com/bgx/latest/cmd/commands#gfu
BGX13 Variable Reference : https://docs.silabs.com/bgx/latest/cmd/variables#sy-i-s
BLE Service overview : https://docs.silabs.com/gecko-os/1/bgx/latest/ble-services#xpress-streaming-service
USBXpress Device configuration and programming guide: https://www.silabs.com/documents/public/application-notes/AN721.pdf
Wireless Xpress BGX13P home page :https://www.silabs.com/products/development-tools/wireless/bluetooth/bgx13p-bluetooth-xpress-starter-kit
Top Comments
Aswin,
Thanks for a comprehensive and thoughtful review. Looks like a great tutorial on this product as well.
Randall Scasny
RoadTest Program Manager