Bluetooth Smart Development with Blue Gecko Modules Mikko Savolainen October 2015
Agenda Bluetooth & the IoT BGM111 Bluetooth Smart Module Blue Gecko Bluetooth Smart Software Software Development Flow Bluetooth Developer Studio How to Find Resources? How to Get Support? Question and Answers 2 Silicon Labs Confidential
Bluetooth and the IoT Ultra low power - Ability to run years on coin cell batteries Connectivity to consumer devices - smart phones, tablets, PCs Supported by major platforms - ios, Android 4.3, Windows 8, OSX and Linux Reliable and robust - AFH, retransmissions and 24-bit CRCs Secure paring, privacy, MITM protection and AES-128 Standardized profiles - cover key use cases (HR, HID, Glucose, Proximity etc.) Enables profiles to be developed as Apps - fast deployment Customer specific profiles no need to wait OS support 3 Silicon Labs Confidential
Introducing the Fully integrated, pre-certified Bluetooth Smart module solution Saves $100-200k in development costs Saves $50k in certification costs Fastest path to low-power wireless connectivity for the Internet of Things 6-12 months faster time-to-market Easy migration path to Silicon Labs Blue Gecko SoC solutions Same software runs on both the module and the SoC 4 Silicon Labs Confidential
Drop-In and Connect Integrated Blue Gecko Bluetooth SoC and Antenna 8 dbm TX High performance 2 dbi gain antenna Software configureable TX power Range up to 200 meters Worldwide Certifications Bluetooth, CE, FCC, IC, Japan and S-Korea 5 Silicon Labs Confidential
Use Energy-Friendly Hardware Powerful MCU ARM Cortex-M4F @ 40 MHz 32kb RAM and 265kB Flash 24kB free RAM and 160kB free flash for apps or OTA Crypto Hardware AES 128/256, SHA-1/2 + ECC Flexible Peripherals Serial: UART, SPI and I2C GPIO with interrupts Analog: 12-bit ADC, DAC and comparator Timers: Timer, RTC, Pulse counter/pwm etc. 6 Silicon Labs Confidential
Easily Extend and Customize Bluetooth Smart Software Bluetooth 4.1 compliant Upgradable to Bluetooth 4.2 Central and peripheral support Free Bluetooth Smart SDK Easy-to-use BGScript TM scripting API BGAPI TM Serial Protocol for apps with host BGLIB TM API for native C applications on host Easy-to-use Tools Energy Profiler RF testing Debug and firmware updates Bluetooth Developer Studio plug-ins 7 Silicon Labs Confidential
Blue Gecko Wireless Starter Kit SEGGER J-LINK LCD BGM111 Module Board Battery + USB powered Buttons Joystick LED Sensors: Temperature Humidity Accelerometer 8 Silicon Labs Confidential
Blue Gecko Bluetooth Smart Software Integrated Bluetooth Smart Software Implements ATT, GATT, SMP and GAP Central and peripheral roles Supports aby GATT based profile Flexible, Easy-to-Use APIs BGAPI TM serial protocol for apps with host BGLIB TM host C-library implementing BGAPI BGScript TM scripting for standalone apps Profile Toolkit TM for building GATT profiles Free Software Development Kit Script development tools BGLIB source code for hosts Example applications in script and C Bluetooth Smart profile examples 9 Silicon Labs Confidential
BGScript Scripting Language Simple event-driven BASIC-like application scripting language Abstracts away the complexity of Bluetooth development, embedded programming and hardware interfaces Enables fast, simple firmware development into Blue Gecko Bluetooth Smart modules Eliminates the need for external MCU 10 Silicon Labs Confidential
Blue Gecko BGAPI Serial Protocol (NCP mode) A well-defined, lightweight serial protocol that works over UART interface Host Stack BGAPI command BGAPI response BGAPI event Some commands will produce events Command validation Command processing Used when the application resides on an external host MCU Contains APIs for GAP, GATT, security manager, connection management, flash and peripheral interfaces Small RAM and flash requirements on the host 11 Silicon Labs Confidential
BGLIB Host Library A portable C library that implements the BGAPI serial protocol parser Abstracts the BGAPI serial protocol and provides high-level C functions and callbacks for application developers Contains APIs for GAP, GATT, security manager, connection management, flash and peripherals Easy to port to various host systems from embedded MCUs to OS platforms including Windows, Linux or OSX 12 Silicon Labs Confidential
Blue Gecko Profile Toolkit A development tool for GATT-based services Simple XML based description langugage for describing services, data and access properties Templates available for most common Bluetooth Smart services 13 Silicon Labs Confidential
ios and Android Apps Reference applications for both ios and Android Implement basic Bluetooth Smart profiles Developer mode for Bluetooth debugging Available in source code 14 Silicon Labs Confidential
BGScript or NCP Development Flow Project Configuration of architecture (NCP vs. BGScript) Hardware type selection Definition of resource files Firmware output file Project File Hardware configuration Bluetooth Services (GATT) Application code (BGScript) Firmware for Blue Gecko Hardware configuration Host interface configuration Peripheral configurtion NCP mode Firmware for Blue Gecko Application code (BGLIB) GATT Services Bluetooth Smart profiles, services and characteristics Application code Either BGScript code Code developed on top of BGLIB for external host 15 Silicon Labs Confidential
Bluetooth Developer Studio Bluetooth Developer Studio can automate and simplify code development Contains all adopted Bluetooth Smart profiles Auto-generates: Project file template Hardware configuration file template Bluetooth Smart GATT database BGScript or BGLIB application code Has a simple and intuitive user interface Download: here 16 Silicon Labs Confidential
Building a Bluetooth Smart Profile Start the Bluetooth Developer Studio Drag and drop the desired profile from the Profiles tab to the designer view Open GAP dialog Configure GAP settings Device name Advertisement parameters Security modes Note: This is a mandatory step Add any other additional services you like 17 Silicon Labs Confidential
Auto-generate a Blue Gecko Project Once you have built your profile and service collection Go to Tools -> Generate Code Select: Blue Gecko Project Generator Press Generate The Developer Studio will generate: A project template A hardware configuration file template GATT.xml with the selected profiles and services BGScript or BGLIB application code template 18 Silicon Labs Confidential
The Project File <project device="bgm111"> The hardware type <gatt in="gatt.xml" /> The GATT file name and location <hardware in="hardware.xml" /> <scripting> </scripting> Hardware configuration file location <script in="bgscript.bgs" /> Enables BGScript and defines the file For NCP projects, just leave this out <image out="firmware.bin" /> Name of the firmware output 19 Silicon Labs Confidential
The Hardware Configuration <uart index="1" baud="115200" flowcontrol="false" bgapi="false"/> Enables UART and configures settings bgapi="false = NCP mode disabled bgapi= true = NCP mode enabled <gpio port="a" pin="5" mode="pushpull" out="1"/> <gpio port="a" pin="3" mode="pushpull" out="0"/> Configures GPIO pins Similar settings for other peripheral interfaces. See: Configuration guide for details 20 Silicon Labs Confidential
Bluetooth Smart Services and Characteristics <service uuid="1816" advertise="true"> Starts a service definition uuid="1816" 16-bit UUID of the service advertise="true UUID added to Advertisement data <characteristic uuid="2a5c" id="xgatt_1816_2a5c" > <properties read="true" /> <value type="hex" length="2" user="true" /> </characteristic> Starts a characteristic definition uuid= 2A5C" id="xgatt_1816_2a5c" properties read="true type="hex" length="2 16-bit UUID of the characteristic ID used by the application Allowed ATT operations Data type and length user="true Value provided by the application 21 Silicon Labs Confidential
The Application Code (BGScript) Variables: For every GATT characteristic a variable is generated procedure initgatt() This procedure can be used to intialize the dynamic values in GATT procedure initgap() Intializes the GAP settings, like advertisement parameters 22 Silicon Labs Confidential
The Application Code (BGScript) event system_boot(major, minor, patch, build, bootloader, hw) Generated on power-up runs initgatt() and initgap() event le_connection_opened( ) Generated when Bluetooth connection established event le_connection_closed(reason, connection) Generated when Bluetooth connection closed/lost 23 Silicon Labs Confidential
Compiling and Installing Firmware Connect Blue Gecko Wireless Starter Kit to your PC via USB Turn the Power swtich to AEM position Start BGTool and use Upload tool to compile and download the firmware Alternatively you can use: bgbuild.exe f project.xml to compile and install the firmware from the command line Test your application Note: For NCP mode this works in a same way, except the application code is generated in C for the host (BGLIB API) 24 Silicon Labs Confidential
How to Find Resources? Documents: Link Software downloads: Link Kits and Modules: BGM111 and Kit Bluetooth Developer Studio Link Bluetooth Smart specifications Link 25 Silicon Labs Confidential
How to Get Support? Knowledgebase: Search of information not in manuals Community: Share information with other users Create a Support Request: Get one-to-one support from our Application Engineers 26 Silicon Labs Confidential
Questions and Answers www.silabs.com