Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module...

14
BT121 Bluetooth ® Smart Ready Module Factory Demo Walkthrough May 2015

Transcript of Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module...

Page 1: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

BT121 Bluetooth® Smart Ready Module – Factory Demo Walkthrough

May 2015

Page 2: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

2 Silicon Labs Confidential

TOPICS

Getting started

The DKBT development Kit

The project file

Hardware configuration

Bluetooth BR/EDR profiles

Bluetooth GATT database

The BGScript code

Compiling and installing firmware

BGTool test application

Page 3: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

3 Silicon Labs Confidential

Download the SDK and Quick Start from:

www.bluegiga.com/bt121

Follow the instructions on the Quick Start

to see how the demo works

The demo is pre-installed on the DKBT

development kits when they are delivered and

also included in the SDK

Folder: examples/bgdemo

Getting Started

Page 4: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

4 Silicon Labs Confidential

The DKBT Development Kit

The carrier board: Contains the BT121 module

The main board: Contains peripherals like Accelerometer, Altimeter,

display

Current measurement ports

Power supply

USB-to-Serial

Button and leds

The demo uses: BT121 running a BGScript application

Display connected via SPI

Altimeter connected via I2C

USB-to-Serial for PC connectivity and SPP data

See: Development Kit User Guide for details

Page 5: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

5 Silicon Labs Confidential

The Project File

Project file defines all the components included in the

project

<gatt> Bluetooth Smart service (GATT) database

<hardware> Hardware interfaces configuration

<sdp> Bluetooth BR/EDR profile configuration

<scripting> BGScript code (if used)

<image> Firmware output binaries

See: Configuration Guide for details

Page 6: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

6 Silicon Labs Confidential

The Hardware Config

Host and peripheral interface configuration

<sleep> Sleep mode configuration

<uart> UART host or peripheral interface settings

bgapi = true (UART used for host)

bgapi = false (UART used for peripherals)

For host comms. RTS/CTS is mandatory

<spi> SPI peripheral interface settings

<port> GPIO configuration

<i2c> I2C peripheral interface settings

See: Configuration Guide for details

Page 7: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

7 Silicon Labs Confidential

The Bluetooth BR/EDR Services

The Bluetooth BR/EDR services need to be defined in

the so called SDP database (Service Discovery Protocol)

<ServiceClassIDList> Service UUID

1101 = Serial Port Profile

<Protocol> RFCOMM channel assignment

5 = RFCOMM channel 5

<ServiceName> Service Name

Shown f.ex by Windows

See: Configuration Guide for details

Page 8: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

8 Silicon Labs Confidential

The Bluetooth BR/EDR Services

Device ID Service = Device identity

<UINT16 value="0201"/> Vendor ID parameter

<UINT16 value="0047"/> Vendor ID value

<UINT16 value=“0202"/> Product ID parameter

<UINT16 value=“1234"/> Product ID value

<UINT16 value=“0205"/> Source of Vendor ID

<UINT16 value=“0001"/> Bluetooth ORG

0002 = USB

See: Configuration Guide for details

Page 9: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

9 Silicon Labs Confidential

The GATT Database

The GATT database defines the services and data for

Bluetooth Smart

Services describe which kind of data the device

exposes

Heart Rate Service

Proximity service

Characteristics define the actual data

Type

Length

Characteristics properties define the access and

security properties

Read, write, indicate, notify

Open, authenticated, encrypted

See: Profile Toolkit Developer Guide for details

Page 10: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

10 Silicon Labs Confidential

The GATT Database The GATT database define the services and data for

Bluetooth Smart

<service> The service definition

uuid = Service UUID

16-bit = Standardized

128-bit = Vendor specific

<characteristic> The data definition

uuid = characteristic UUID

16-bit = Standardized

128-bit = Vendor specific

<properties> Characteristic properties

read, write, indicate, notify

const = constant (fixed) values

<value> The actual data

type = hex or UTF-8

See: Profile Toolkit Developer Guide for details

Page 11: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

11 Silicon Labs Confidential

The BGScript Code

BGScript is used to implement the application

event system_boot(...)

Like main() function in C

Always generated on power-up

call function_name(parameter) (return value)

Used to run a function

Parameters given inside brackets

Return values (if any) returned right away

event event_handler(parameters)

Usually generated by a function call

Or events like a Bluetooth connection,

ADC read, software timer

Write the application code in the event handler

Page 12: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

12 Silicon Labs Confidential

Compiling and Installing Firmware

Compiling from command line:

SDK includes BGBuild compiler for the firmware

Compiles the Bluetooth stack, hardware configuration,

BR/EDR services, GATT database and BGScript (optional)

into a firmware image

Syntax : bgbuild.exe <project file>

Firmware update from command line:

SDK includes BGUpdate.exe tool to perform a DFU update

Uploads the firmware image to the module over UART

Syntax : bgupdate.exe <COM port> <project file>

Page 13: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

13 Silicon Labs Confidential

BGTool Test Application

BGTool can be used to test the BT121 using the

BGAPI serial protocol.

You can make device discovery

Bluetooth connections

Bluetooth security

Data exchange

Firmware updates over UART

BGTool is included in the SDK.

To use BT121 with BGTool you need to install a

correct firmware into the module, which included

in the SDK

Folder: examples/bt121

Page 14: Bluetooth Smart Ready Module Factory Demo Walkthrough · BT121 Bluetooth® Smart Ready Module –Factory Demo Walkthrough May 2015

Thank You