STMicroelectronics BlueNRG-1, BlueNRG-2 User Manual

UM2071
User manual
BlueNRG-1, BlueNRG-2 development kits
Introduction
The BlueNRG-1 and BlueNRG-2 devices are low power Bluetooth Low Energy (BLE) systems-on-chip that are compliant with the Bluetooth® specification and support master, slave and simultaneous master-and-slave roles. BlueNRG-2 also supports the
Bluetooth Low Energy data length extension feature.
The following BlueNRG-1, BlueNRG-2 kits are available:
1. BlueNRG-1 development platforms (order code: STEVAL-IDB007V1
2. BlueNRG-2 development platforms (order code: STEVAL-IDB008V1
IDB008V1M)
1. This board is no longer available for purchase
The development platforms feature hardware resources for a wide range of application scenarios: sensor data (accelerometer, pressure and temperature sensor), remote control interfaces (buttons and LEDs) and debug message management through USB virtual COM. Three power options are available (USB only, battery only and external power supply plus USB) for high application development and testing flexibility.
STEVAL-IDB007V2)
,
, STEVAL-IDB008V2, STEVAL-IDB009V1, STEVAL-
RELATED LINKS
The document content is also valid for the BlueNRG-1 STEVAL-IDB007V1M evaluation platform based on the SPBTLE-1S module with 32 MHz HS crystal.
UM2071 - Rev 12 - June 2020 For further information contact your local STMicroelectronics sales office.
www.st.com

1 Development platforms

UM2071
Development platforms
Figure 1. STEV
This item is no longer available for sale
Figure 2. STEV
based on BlueNRG-1 SoC
AL-IDB007V1 development platform
AL-IDB007V2 development platform
UM2071 - Rev 12
page 2/94
UM2071
Development platforms
based on BlueNRG-2 SoC
based on BlueNRG-2 SoC
Figure 3. STEV
AL-IDB008V1 development platform
Figure 4. STEVAL-IDB008V2 development platform
UM2071 - Rev 12
page 3/94
UM2071
Development platforms
Figure 5. STEV
based on BlueNRG-2 SoC in QFN48 package
AL-IDB009V1 development platform
Figure 6. STEVAL-IDB008V1M development platform
based on BlueNRG-M2SA module with embedded BlueNRG-2 SoC
UM2071 - Rev 12
page 4/94

2 Getting started

2.1 Kit contents

The STEVAL-IDB007Vx/STEVAL-IDB008Vx kits include respectively:
a
BlueNRG-132 (QFN32 package)/BlueNRG-232 (QFN32 package) development platform
a 2.4 GHz Bluetooth antenna
a USB cable
The STEVAL-IDB009Vx kit includes:
a BlueNRG-248 (QFN48 package) development platform
a 2.4 GHz Bluetooth antenna
a USB cable
The STEVAL-IDB008V1M kit includes:
a BlueNRG-M2SA certified module based on the BlueNRG-2 Bluetooth low energy system-on-chip
a USB cable
UM2071
Getting started

2.2 System requirements

The BlueNRG-1, BlueNRG-2 Navigator and Radio Init Parameters Wizard PC applications require:
PC with Intel® or AMD® processor running Windows 7/10
At least 128 MB of RAM
USB ports
At least 40 MB of available hard disk space
Adobe Acrobat Reader 6.0 or later

2.3 BlueNRG-1_2 development kit setup

The following BlueNRG-1, BlueNRG-2 DK software packages are available: BlueNRG-1_2 DK SW package for BlueNRG-1, BlueNRG-2 BLE stack v2.x family (STSW
After downloading the selected software package (STSW bluenrg1-dk.zip contents to a temporary directory, launch BlueNRG-1_2-DK-x.x.x-Setup.exe and follow the on­screen instructions.
Note: EWARM Compiler 8.40.1 or later, Keil MDK-ARM v5.27 or later and Atollic-True Studio v8.1.0 are required for
building the related BlueNRG1_2_DK_x.x.x demonstration applications.
-BLUENRG1-DK).
-BLUENRG1-DK) from www.st.com, extract en.stsw-
UM2071 - Rev 12
page 5/94
Hardware description

3 Hardware description

3.1 STEVAL-IDB007Vx/STEVAL-IDB008Vx/STEVAL-IDB009Vx board overview

UM2071
The BlueNRG-1/BlueNRG-2 development kits lets you experiment with BlueNRG-1/BlueNRG-2 system on chip functions. They feature:
Bluetooth® Low Energy (BLE) board based on the BlueNRG-1/BlueNRG-2 Bluetooth low energy system on chip
Associated development kit SW package including firmware and documentation
Up to +8 dBm available output power (at antenna connector)
Excellent receiver sensitivity (-88 dBm)
Very low power consumption: 7.7 mA RX and 8.3 mA TX at -2 dBm
Bluetooth® low energy compliant, supports master, slave and simultaneous master-and-slave roles
Integrated balun which integrates a matching network and harmonics filter (only on STEVAL-IDB007Vx/ STEVAL-IDB008Vx)
Discrete matching network on STEVAL-IDB009V1
BlueNRG-M2SA certified module based on the BlueNRG-2 Bluetooth LE SoC on STEVAL-IDB008V1M
SMA connector for antenna or measuring equipment (not available on STEVAL-IDB007V1M/8V1M)
3 user LEDs
2 user buttons
3D digital accelerometer and 3D digital gyroscope
MEMS pressure sensor with embedded temperature sensor
Battery holder
JTAG debug connector
USB to serial bridge for providing I/O channel with the BlueNRG-1/BlueNRG-2 device
Jumper for measuring current for BlueNRG-1/BlueNRG-2 only
RoHS compliant
The following figure and table describe physical sections of the board.
devices in the STEV
AL-IDB007Vx/STEV
AL-IDB008Vx/STEVAL-IDB009Vx
Figure 7. STEVAL-IDB007Vx board components
UM2071 - Rev 12
page 6/94
UM2071
STEVAL-IDB007Vx/STEVAL-IDB008Vx/STEVAL-IDB009Vx board overview
Figure 8. STEV
Figure 9. STEV
AL-IDB008Vx board components
AL-IDB009V1 board components
UM2071 - Rev 12
Table 1. STEVAL-IDB007Vx/STEVAL-IDB008Vx/STEVAL-IDB009Vx board component descriptions
Region Description
BlueNRG-132 SoC on STEVAL-IDB007Vx
(1)
A
C
O JTAG connector
M RESET button
N Two USER buttons
BlueNRG-232 SoC on STEVAL-IDB008Vx
BlueNRG-248 SoC on STEVAL-IDB009Vx
Micro USB connector for power supply and I/O
page 7/94
Region Description
H LPS25HB MEMS pressure sensor with embedded temperature
I LSM6DS3 3D digital accelerometer and 3D digital gyroscope
G
P
PWR LED
Three user LEDs
Back of the PCB Battery holder for two AAA batteries
J, L Two rows of Arduino-compliant connectors
Integrated balun with matching network and harmonics filter (BALF-NRG-01D3 on STEV
S
AL-IDB008V1
STEV
and BALF-NRG-02D3 on STEVAL-IDB007V2/STEVAL-IDB008V2). Discrete matching
network on STEVAL-IDB009V1.
Q
STM32L151CBU6 48-pin microcontroller (USB to serial bridge for I/O channel to PC communication)
R ST2378E level translator to adapt voltage level between STM32 and BlueNRG-1
16 MHz High Speed Crystal on STEVAL-IDB007Vx
T
32 MHz High Speed Crystal on STEVAL-IDB008Vx, STEVAL-IDB009Vx, STEV IDB007V1M/8V1M
1.On STEVAL-IDB008V1M, region A contains the BlueNRG-M2SA module
On STEVAL-IDB007V1M, region A contains the SPBTLE-1S module
2. STM32 is not intended to be programmed by users
UM2071
BlueNRG-1, BlueNRG-2 SoC connections
AL-IDB007V1/
(2)
AL-IDB009Vx, STEVAL-

3.2 BlueNRG-1, BlueNRG-2 SoC connections

The BlueNRG-132, BlueNRG-232 very low power Bluetooth low energy (BLE) single-mode system on chip (Figure 7. STEVAL-IDB007Vx board components – region A /Figure 8. STEV region A) have respectively 160 KB, 256 KB of Flash, 24 KB of RAM, a 32-bit core ARM Cortex-M0 processor and several peripherals (ADC, 15 GPIOs, I²C, SPI, Timers, UART, WDG and RTC).
The BlueNRG-248 very low power Bluetooth low energy (BLE) single-mode system on chip has 256 KB of Flash, 24 KB of RAM, a 32-bit core ARM cortex-M0 processor and several peripherals (ADC, 26 GPIOs, I²C, SPI, Timers, UART, WDG and RTC).
The microcontroller is connected to various components such as buttons, LEDs and sensors. The following table describes the microcontroller pin functions.
Table 2. BlueNRG-1, BlueNRG-2 pins description with board functions
Pin no. Board function
Pin name
QFN3 2
QFN4
(1)
8
LEDs Micro Buttons
(2)
DIO10 1 46
DIO9 2 47
DIO8 3 4
DIO7 4
5 DL2
DIO6 5 5 DL1
VBAT3 6 40
TXD (P
A2)
Pressure sensor
3D accelerometer and gyroscope
AL-IDB008Vx board components -
JTAG CN1 CN2 CN3 CN4
JTMS­SWTDI O
JTCK­SWTCK
pin 1 (IO8)
pin 2 (IO9)
pin 2 (TX)
pin 7 (IO6)
pin 6 (SCL)
pin 5 (SDA)
UM2071 - Rev 12
page 8/94
Pin no. Board function
Pin name
QFN3
(1)
2
QFN4
(2)
8
LEDs Micro Buttons
Pressure sensor
3D accelerometer and gyroscope
SDA
DIO5 7 9
(PUSH2 button)
DIO4 8 13 SCL
DIO3 9 14 SDO/SA0
DIO2 10 15 SDA
DIO1 11 16 CS
DIO0 12 18 SCL
DIO14/ ANA
TEST013 21/23
DL3
UM2071
BlueNRG-1, BlueNRG-2 SoC connections
JTAG CN1 CN2 CN3 CN4
pin 9 (SDA)
pin 10 (SCL)
JTAG­TDO
JTAG­TDI
pin 5 (MISO)
pin 4 (MOSI)
pin 3 (CS)
pin 6 (SCK)
pin 6 (IO5)
pin 5 (IO4)
pin 4 (IO3)
pin 4 (AD3)
ANATES T1
14 24
ADC1 15 25
ADC2 16 26
FXTAL1 17 27
FXTAL0 18 28
VBAT2 19 29
RF1 20 30
RF0 21 31
SXTAL1 22 33
SXTAL0 23 34
VBAT1 24 35
RESET 25 36 RESET RESET RESET
SMPSFI L
T1
SMPSFI LT2
VDD1V2
26 37
27 38
28 39
DIO13 29 41 PUSH1
DIO12 30 42 INT1
FTEST 31 43
DIO11 32 44
RXD (P
A3)
pin 3 (NRST)
pin 8 (IO7)
pin 1 (RX)
pin 3 (IO2)
pin 3 (AD2)
pin 1 (AD0)
pin 2 (AD1)
UM2071 - Rev 12
page 9/94
Pin no. Board function
Pin name
DIO15 - 20
DIO16 - 19
DIO17 - 17
DIO18 - 12
DIO19 - 11
DIO20 - 10
DIO21 - 6
DIO22 - 3
DIO23 - 2
DIO24 - 1
VBAT4 - 8/22
DIO25 - 48
QFN3 2
QFN4
(1)
(2)
8
LEDs Micro Buttons
Pressure sensor
3D accelerometer and gyroscope
UM2071
Power supply
JTAG CN1 CN2 CN3 CN4
1. QFN32 package on STEVAL-IDB007Vx and STEV
2. QFN48 package on STEVAL-IDB009Vx kits.
The board section labeled respectively BlueNRG-1, BlueNRG-2 (Figure 7. STEVAL-IDB007Vx board
components, Figure 8. STEV
AL-IDB008Vx board components, Figure 9. STEVAL-IDB009V1 board components
region B) includes the following main components:
BlueNRG-1/BlueNRG-2 low power system on chip (in a QFN32 package for STEVAL-IDB007Vx, STEVAL­IDB008Vx, QFN48 package for STEVAL-IDB009Vx) )
BlueNRG-M2SA certified module based on the BlueNRG-2 Bluetooth LE SoC on STEVAL-IDB008V1M
High frequency 16 MHz crystal on STEVAL-IDB007Vx and 32 MHz crystal on STEVAL-IDB008Vx, STEVAL­IDB009Vx
Low frequency 32 kHz crystal for the lowest power consumption
Integrated balun which integrates a matching network and harmonics filter
SMA connector (not available on STEVAL-IDB007V1M/8V1M)

3.3 Power supply

Green LED DL4 (Figure 7.
components, Figure 9. STEVAL-IDB009V1 board components – region G) signals the board is being powered,
either via:
micro USB connector CN5 (Figure 7. STEVAL-IDB007Vx board components, Figure 8. STEVAL-IDB008Vx
board components, Figure 9. STEVAL-IDB009V1 board components – region C)
two AAA batteries (region F)
an external DC power supply plus micro USB connector
The following table describes the power supply modes available on the STEVAL-IDB007V1, STEVAL-IDB008V1 boards and corresponding jumper settings.
STEVAL-IDB007Vx board components, Figure 8.
AL-IDB008Vx kits.
STEVAL-IDB008Vx board
UM2071 - Rev 12
Table 3. STEVAL-IDB007Vx, STEVAL-IDB008Vx, STEVAL-IDB009Vx kit platform power supply modes
Power supply mode JP1 JP2 Comment
1 - USB Fitted: 1-2 Fitted: 2-3
USB supply through connector CN5 (Figure 7. STEV
components, Figure 8. STEV Figure 9. STEVAL-IDB009V1 board components – region C)
AL-IDB008Vx board components,
AL-IDB007Vx board
page 10/94
Power supply mode JP1 JP2 Comment
2 - Battery Fitted: 2-3 Fitted: 1-2 The supply voltage must be provided through battery pins (region F).
3 - Combo Fitted: 1-2 Optional

3.4 Jumpers

The available jumpers are listed in the table below.
UM2071
Jumpers
USB supply through connector CN5 for STM32L1; JP2 pin 2 external power for
BlueNRG-1, BlueNRG-2
able 4. STEVAL-IDB007Vx, STEV
T
Jumper Description
JP1
JP2
JP3
JP4 Fitted: to provide VBLUE to BlueNRG-1, BlueNRG-2. It can be used also for current measurement.
JP5
1-2: to provide power from USB (JP2: 2-3)
2-3: to provide power from battery holder (JP2: 1-2)
1-2: to provide power from battery holder (JP1: 2-3)
2-3: to provide power from USB (JP1: 1-2)
JP2 pin 2 to VDD to provide external power supply to BlueNRG-1, BlueNRG-2 (JP1: 1-2)
pin 1 and 2 UART RX and TX of MCU
pin 3 GND
Fitted: TEST pin to VBLUE
Not fitted: TEST pin to GND
AL-IDB008Vx, STEVAL-IDB009Vx kit platform jumpers

3.5 Sensors

The following sensors are available on the platform:
An LPS25HB
1.
components, Figure 9. STEVAL-IDB009V1 board components – region H) is a piezoresistive absolute
pressure sensor which functions as a digital output barometer. The device comprises a sensing element and an IC interface which communicates through I²C from the sensing element to the application.
2. An LSM6DS3 3D (region I) digital accelerometer and 3D digital gyroscope with embedded temperature sensor which communicates via SPI interface. One line for interrupt is also connected.
Note: In battery operating mode, if R59, R60 and R62 resistors are mounted, you should remove them to make
LSM6DS3 function correctly.
(Figure 7. STEVAL-IDB007Vx board components, Figure 8. STEVAL-IDB008Vx board

3.6 Extension connector

BlueNRG-1, BlueNRG-2 signal test points are shared on two Arduino-compliant connector rows: CN1, CN3
(Figure 7. STEV
AL-IDB007Vx board components, Figure 8. STEVAL-IDB008Vx board components, Figure 9. STEVAL-IDB009V1 board components – region J) and CN2, CN4 (region L). See Table 2. BlueNRG-1, BlueNRG-2 pins description with board functions.

3.7 Push-buttons

The board has one user button to reset the microcontroller (Figure 7. STEVAL-IDB007Vx board components,
Figure 8. STEVAL-IDB008Vx board components, Figure 9. STEVAL-IDB009V1 board components – region M)
and two further buttons for application purposes (region N).
Note: The PUSH1 button is not connected on the STEVAL-IDB008V1M as DIO13 is not available on the BlueNRG-
M2SA module (PUSH1 is also not connected on STEVAL-IDB007V1M).
UM2071 - Rev 12
page 11/94

3.8 JTAG connector

UM2071
JTAG connector
A JTAG connector (Figure 7.
components, Figure 9. STEVAL-IDB009V1 board components – region O) allows BlueNRG-1, BlueNRG-2
microcontroller programming and debugging with an in-circuit debugger and programmer such as ST-LINK/V2.
Note: Only SWD mode is supported
STEV
AL-IDB007Vx board components, Figure 8.
STEVAL-IDB008Vx board

3.9 LEDs

LEDs DL1 (yellow), DL2 (red), DL3 (blue) and DL4 (green, power LED) are available on the board (Figure 7. STEVAL-IDB007Vx board components, Figure 8. STEVAL-IDB008Vx board components,
Figure 9. STEV
AL-IDB009V1 board components – regions G and P).

3.10 STM32L151CBU6 microcontroller

The most important feature of the STM32L151CBU6 48-pin microcontroller (Figure 7. STEVAL-IDB007Vx board
components, Figure 8. STEVAL-IDB008Vx board components, Figure 9. STEVAL-IDB009V1 board components
regions Q) is the USB to serial bridge providing an I/O channel with the BlueNRG-1, BlueNRG-2 device.
The microcontroller is connected to the BlueNRG-1, BlueNRG-2 device through an ST2378E level translator (region R).
Note: The STM32L microcontroller on the board is not intended to be programmed by users. ST provides a pre-
programmed firmware image for the sole purpose of interfacing BlueNRG-1, BlueNRG-2 to a USB host device (e.g., a PC).

3.11 Integrated balun with matching network and harmonics filter

BALF-NRG-01D3 and BALF-NRG-02D3 devices are ultra-miniature baluns which integrate matching network and
harmonics filter on STEV
AL-IDB009V1.
STEV
AL-IDB007Vx and STEVAL-IDB008Vx. Discrete matching network is available on

3.12 Current measurements

To monitor the power consumption of the BlueNRG-1, BlueNRG-2 only, remove the jumper from JP4 and insert an ammeter between pins 1 and 2 of the connector (when the power is ON, remove the USB connection).
Since power consumption of the BlueNRG-1, BlueNRG-2 are usually very low, an accurate instrument in the range of few micro amps is recommended.

3.13 Hardware setup

Connect an antenna to the SMA connector
1.
2. Configure the board to USB power supply mode as per Table 3. STEV
STEVAL-IDB009Vx kit platform power supply modes
3. Connect the board to a PC via USB cable (connector CN5)
4. Verify the power indication LED DL4 is on.
AL-IDB007Vx, STEVAL-IDB008Vx,
UM2071 - Rev 12
page 12/94

4 BlueNRG-1, BlueNRG-2 Navigator

BlueNRG-1, BlueNRG-2 Navigator are user friendly GUI which lets you select and run demonstration applications
easily
, without requiring any extra hardware. With it, you can access the following DK software package
components:
BlueNRG-1, BlueNRG-2 Bluetooth low energy (BLE) demonstration applications
BlueNRG-1, BlueNRG-2 peripheral driver examples
BlueNRG-1, BlueNRG-2 2.4 GHz radio proprietary examples
BlueNRG-1, BlueNRG-2 development kits
release notes
license files
With BlueNRG-1, BlueNRG-2 DK Navigator, you can directly download and run the selected prebuilt application binary image (BLE examples or peripheral driver example) on the BlueNRG-1, BlueNRG-2 platform without a JTAG interface.
The interface gives demo descriptions and access to board configurations and source code if needed.
User can run the utility through the BlueNRG-1 and BlueNRG-2 Navigator icon under:
Start → ST BlueNRG -1_2 DK X.X.X → BlueNRG-1 Navigator, BlueNRG-2 Navigator.
UM2071
BlueNRG-1, BlueNRG-2 Navigator
Figure 10. BlueNRG-1 Navigator
Note: BlueNRG-1 Navigator and BlueNRG-2 Navigator are two instances of the same application tailored for the
specific selected device, in order to select the related available resources. Next sections focus on BlueNRG-1 Navigator, but same concepts are also valid for BlueNRG-2 Navigator.

4.1 BlueNRG-1 Navigator ‘Demonstration Applications’

ou can navigate the menus for the reference/demo application you want to launch. For each application, the
Y following information is provided:
Application settings (if applicable)
Application description
Application hardware related information (e.g., LED signals, jumper configurations, etc.)
The following functions are also available for each application:
UM2071 - Rev 12
page 13/94
UM2071
BlueNRG-1 Navigator ‘Demonstration Applications’
Flash: to automatically download and run the available prebuilt binary file to a BlueNRG-1 platform
connected to a PC USB port.
Doc: to display application documentation (html format)
Project: to open the project folder with application headers, source and project files.
The figure below shows you how to run the BLE Beacon demo application; the other demos function similarly
.
Figure 1
1. BLE Beacon application
When a BlueNRG-1 platform is connected to your PC USB port, you can press the “Flash & Run” tab on the selected application window to download and run the available prebuilt application binary image on the BlueNRG-1 platform.
Figure 12. BLE Beacon Flash programming
Selecting the “Doc” tab opens the relative html documentation.
UM2071 - Rev 12
page 14/94
Figure 13. BLE Beacon documentation

4.1.1 BlueNRG-1 Navigator ‘Basic examples’

This page lists some basic sample applications for the BlueNRG-1 device to verify that BlueNRG-1 device is alive as well as the device sleep and wakeup modes.
Figure 14. Basic examples
UM2071
BlueNRG-1 Navigator ‘Demonstration Applications’

4.1.2 BlueNRG-1 Navigator ‘BLE demonstration and test applications’

This page lists all the available Bluetooth low energy (BLE) demonstration applications in the DK software package. These applications provide usage examples of the BLE stack features for the BlueNRG-1 device.
UM2071 - Rev 12
page 15/94
BlueNRG-1 Navigator ‘Demonstration Applications’
Figure 15. BLE demonstration and test applications
UM2071

4.1.3 BlueNRG-1 Navigator ‘Peripherals driver examples’

This page lists the available BlueNRG-1 peripherals and corresponding test applications to work with certain features specific to the selected BlueNRG-1 peripheral.
Figure 16. Peripherals driver examples

4.1.4 BlueNRG-1 Navigator ‘2.4 GHz radio proprietary examples’

The Radio low level driver provides access to the BlueNRG-1 device radio to send and receive packets without using the Bluetooth link layer
UM2071 - Rev 12
.
page 16/94
UM2071
BlueNRG-1 Navigator ‘Development Kits’
The 2.4 GHz radio proprietary examples built on top of the Radio low level driver can be used as reference examples for building other applications which use the BlueNRG-1 Radio.
Figure 17. 2.4 GHz radio proprietary examples

4.2 BlueNRG-1 Navigator ‘Development Kits’

This window displays the available BlueNRG-1 DK kit platforms and corresponding resources. When you hover the mouse pointer on a specific item, the related component is highlighted on the board.
Figure 18. STEVAL-IDB007V2 kit components

4.2.1 BlueNRG-1 Navigator ‘Release Notes’ and ‘License’

As their name suggests, these pages display the DK SW package Release Notes (html format) and the DK software package license file, respectively.
UM2071 - Rev 12
page 17/94

5 BlueNRG-X Radio Init Parameters Wizard

The BlueNRG-X Radio Parameters Wizard is a PC application which allows to define the proper values required for the correct BlueNRG-1, BlueNRG-2 BLE radio initialization, based on the specific user application scenario. As consequence of the user choices, a configuration header file (*_config.h) is generated: this file must be used on the user demonstration application folder
Note:
The BlueNRG-X Radio Init Parameters W
BLUENRG1-DK) supporting BLE stack v2.x family.

5.1 How to run

User can run this utility by clicking on the BlueNRG-X Radio Init Parameters Wizard icon under: Start → ST BlueNRG -1_2 DK X.X.X
Figure 19. BlueNRG-X Radio Init Parameters Wizard
.
izard is provided only on BlueNRG-1_2 DK SW package (STSW-
UM2071
BlueNRG-X Radio Init Parameters Wizard

5.2 Main user interface window

In the left section of the BlueNRG-X Radio Init Parameters Wizard Utility, user can select the following topics allowing to define the specific radio initialization parameters based on the specific BLE application requirements:
General Configuration
1.
2. Radio Configuration
3.
Service Configuration
4. Connection Configuration
5. Security DataBase configuration
6. OTA configuration
7. Stack configuration
8. Overview
UM2071 - Rev 12
page 18/94
UM2071
Main user interface window
9. Output
Refer to the BlueNRG-X Radio Init Parameters Wizard documentation available within BlueNRG-1_2 DK SW package for more details about each provided configuration section.
UM2071 - Rev 12
page 19/94
Programming with BlueNRG-1, BlueNRG-2 system on chip

6 Programming with BlueNRG-1, BlueNRG-2 system on chip

UM2071
The BlueNRG-1, BlueNRG-2 Bluetooth low energy (BLE) stack is provided as a binary library control BLE functionality user is simply requested to link this binary library to his or her application and use the relevant APIs to access BLE functions and complete the stack event callbacks to manage responses according to application requirements.
A set of software driver APIs is also included for accessing the BlueNRG-1, BlueNRG-2 SoC peripherals and resources (ADC, GPIO, I²C, MFTX, Micro, R
The development kit software includes sample code demonstrating how to configure BlueNRG-1, BlueNRG-2 and use the device peripherals and BLE APIs and event callbacks. Documentation on the BLE APIs, callbacks, and peripheral drivers are provided in separate documents.
. Some callbacks are also provided for user applications to handle BLE stack events. The
TC, SPI, SysTick, UART and WDG).
. A set of APIs to

6.1 Software directory structure

The BlueNRG-1, BlueNRG-2 DK software packages files are organized in the following main directories:
Application: containing BlueNRG-1, BlueNRG-2 Navigator and Radio Init Parameters Wizard PC
applications.
Doc: with doxygen BLE APIs and events, BlueNRG-1, BlueNRG-2 peripheral drivers, BLE demo
applications, BlueNRG-1, BlueNRG-2 Peripheral examples, BlueNRG-1, BlueNRG-2 SDK and HAL driver documentation, DK release notes and license file.
Firmware: with prebuilt binary BLE and peripheral driver sample applications.
Library
Bluetooth LE: Bluetooth low energy stack binary library and all the definitions of stack APIs, stack and
events callbacks. BLE stack v2.1 or later configuration header and source files.
cryptolib: AES library
BLE_Application: BLE application framework files (BLE stack layers define values, OTA FW upgrade,
BLE utilities, master library).
BlueNRG1_Periph_Driver: BlueNRG-1, BlueNRG-2 drivers for device peripherals (ADC, clock, DMA,
Flash, GPIO, I²C, timers, R
CMSIS: BlueNRG-1 CMSIS files.
SDK_Eval_BlueNRG1: SDK drivers providing an API interface to the BlueNRG-1, BlueNRG-2 platform
hardware resources (LEDs, buttons, sensors, I/O channel).
HAL: Hardware abstraction level APIs for abstracting certain BlueNRG-1 hardware features (sleep
modes, clock based on SysTick, etc.).
STM32L: BlueNRG-1, 2 network coprocessor framework example for an external microcontroller
Project
BLE_Examples: Bluetooth low energy demonstration application including Headers, source files and
EWARM, Keil and Atollic project files.
BlueNRG1_Periph_Examples: with sample applications for the BlueNRG-1, BlueNRG-2 peripherals
and hardware resources, including Headers, source files and project files.
STM32L: BlueNRG-1, 2 network coprocessor demonstration application examples for an external
microcontroller.
Utility: contains some utilities
Note: The selection between BlueNRG-1, BlueNRG-2 device is done at compile time using a specific define value
BLUENRG2_DEVICE for selecting BlueNRG-2 device. Default configuration (no define value) selects BlueNRG-1 device.
Note: BLE_Application folder is available only on BlueNRG-1_2 DK SW package v3.0.0 or later.
Note: Starting from BlueNRG-1_2 DK SW package 3.1.0, Library, Project and Utility folders are located under C:\Users
\{username}\ST\BlueNRG-1_2 DK x.x.x, in order to be able to directly compile projects even with Windows User Account Control activated.
.
TC, SPI, UARR and watchdog).
UM2071 - Rev 12
page 20/94

7 BLE beacon demonstration application

UM2071
BLE beacon demonstration application
The BLE beacon demo is supported by the BlueNRG-1, BlueNRG-2 development platforms (STEV
AL-IDB008Vx, STEV
STEV
AL-IDB009Vx). It demonstrates how to configure a BlueNRG-1 device to advertise
specific manufacturing data and allow another BLE device to determine whether it is in BLE beacon device range.

7.1 BLE Beacon application setup

This section describes how to configure a BLE device to act as a beacon device.

7.1.1 Initialization

The BLE stack must be correctly initialized thus:
aci_gatt_init(); aci_gap_init(GAP_PERIPHERAL_ROLE, 0, 0x08, &service_handle, &dev_name_char_handle, &appearanc e_char_handle);
See the BLE stack documentation for more information on these and following commands.

7.1.2 Define advertising data

The BLE Beacon application advertises the following manufacturing data:
Table 5. BlueNRG-1 Beacon advertising manufacturing data
Data field Description Notes
Company identifier code
ID Beacon ID Fixed value
Location UUID Beacons UUID Used to distinguish specific beacons from others
Major number Identifier for a group of beacons Used to group a related set of beacons
Minor number Identifier for a single beacon Used to identify a single beacon
Tx Power 2's complement of the Tx power Used to establish how far you are from device
1. available at: https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers

7.1.3 Entering non-connectable mode

The BLE Beacon device uses the GAP API command to enter non-connectable mode thus:
SIG company identifier
AL-IDB007Vx,
(1)
Default is 0x0030 (STMicroelectronics)
UM2071 - Rev 12
aci_gap_set_discoverable(ADV_NONCONN_IND, 160, 160, PUBLIC_ADDR, NO_WHITE_LIST_USE,0, NULL, 0, NULL, 0, 0);
To advertise the specific selected manufacturer data, the BLE Beacon application can use the following GAP APIs:
page 21/94
UM2071
BLE Beacon FreeRTOS example
/* Remove TX power level field from the advertising data: it is necessary to have enough space for the beacon manufacturing data */ aci_gap_delete_ad_type(AD_TYPE_TX_POWER_LEVEL); /* Define the beacon manufacturing payload */ uint8_t manuf_data[] = {26, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x30, 0x00, //Company identifier code (Default is 0x0030 - STMicroelectronics) 0x02,// ID 0x15,//Length of the remaining payload 0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4, //Location UUID 0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61, 0x00, 0x02, // Major number 0x00, 0x02, // Minor number 0xC8//2's complement of the Tx power (-56dB)}; }; /* Set the beacon manufacturing data on the advertising packet */ aci_gap_update_adv_data(27, manuf_data);
Note: BLE Beacon with Flash Management demonstration application is also available. It allows to configure a Beacon
device as with the original Beacon demo application; it also shows how to properly handle Flash operations (Erase and Write) and preserve the BLE radio activities. This is achieved by synchronizing Flash operations with the scheduled BLE radio activities through the aci_hal_end_of_radio_activity_event() event callback timing information.

7.2 BLE Beacon FreeRTOS example

A specific new Beacon project (BLE_Beacon_FreeRTOS) shows how to use FreeR
TOS with ST BLE stack v2.x. The example configures a BLE device in advertising mode (non-connectable mode) with specific manufacturing data and the BTLE_StackTick() is called from a FreeRTOS task (BLETask).
A task randomly changes the Minor number in the advertising data every 500 ms, sending a message through UART each time. Another task sends other messages through UART every 200 ms and generates a short pulse on LED3 (visible with a logic analyzer or oscilloscope).
In this example, low priority has been assigned to the BLETask.
Assigning high priority to a BLETask can give better latency; if some tasks require a lot of CPU time, it is recommended to assign them a lower priority than the BLETask to avoid BLE operations slowing down. Only for tasks that perform very short sporadic operations before waiting for an event, it is still reasonable to choose a priority higher than the BLETask.
UM2071 - Rev 12
page 22/94

8 BLE chat demo application

The BLE chat demo (server and client roles) is supported on the BlueNRG-1, BlueNRG-2 development platforms (STEV
AL-IDB007Vx, STEV
between two BLE devices, demonstrating point-to-point wireless communication using the BlueNRG-1 product.
This demo application exposes a single chat service with the following (20 byte max.) characteristic values:
The TX characteristic, with which the client can enable notifications; when the server has data to be sent, it
sends notifications with the value of the TX characteristic.
The RX characteristic, is a writable characteristic; when the client has data to be sent to the server, it writes
a value in this characteristic.
There are two device roles which can be selected through the specific project workspace:
The Server that exposes the chat service (BLE peripheral device).
The Client that uses the chat service (BLE central device).
The application requires two devices to be programmed with respective server and client roles. These must be connected to a PC via USB with an open serial terminal for each device, with the following configurations:
AL-IDB008Vx, STEV
Table 6. Serial port configuration
UM2071
BLE chat demo application
AL-IDB009Vx). It implements simple two-way communication
Parameter Value
Baudrate 115200 bit/s
Data bits 8
Parity bits None
Stop bits 1
The application listens for keys typed in one device terminal and sends them to the remote device when the return key is pressed; the remote device then outputs the received RF messages to the serial port. Therefore, anything typed in one terminal becomes visible in the other.

8.1 Peripheral and central device setup

This section describes how two BLE chat devices (server-peripheral and client-central) interact with each other to set up a point-to-point wireless chat.
BLE device must first be set up on both devices by sending a series of API commands to the processor.

8.1.1 Initialization

The BLE stack must be correctly initialized before establishing a connection with another BLE device. This is done with aci_gatt_init() and aci_gap_init()
aci_gatt_init();
BLE Chat server role:
APIs:
UM2071 - Rev 12
aci_gap_init(GAP_PERIPHERAL_ROLE, 0, 0x08, &service_handle, &dev_name_char_handle, &appearanc e_char_handle);
BLE Chat client role:
aci_gap_init(GAP_CENTRAL_ROLE, 0, 0x08, &service_handle, &dev_name_char_handle, &appearance_c har_handle);
Peripheral and central BLE roles must be specified in the aci_gap_init() command. See the BLE stack API documentation for more information on these and following commands.
page 23/94

8.1.2 Add service and characteristics

The chat service is added to the BLE chat server device via:
aci_gatt_add_service(UUID_TYPE_128, &service_uuid, PRIMARY_SERVICE, 7,&chatServHandle);
Where service_uuid is the private service 128-bit UUID allocated for the chat service (Primary service). The command returns the service handle in chatServHandle. The TX characteristic is added using the following command on the BLE Chat server device:
aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &charUuidTX, 20, CHAR_PROP_NOTIFY, ATTR_PERM ISSION_NONE, 0, 16, 1, &TXCharHandle);
Where charUuidTX is the private characteristic 128-bit UUID allocated for the TX characteristic (notify property). The characteristic handle is returned on the TXCharHandle variable.
The RX characteristic is added using the following command on the BLE Chat server device:
aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &charUuidRX, 20, CHAR_PROP_WRITE|CHAR_PROP_W RITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_SERVER_ATTR_WRITE,16, 1, &RXCharHandle);
Where charUuidRX is the private characteristic 128-bit UUID allocated for the RX characteristic (write property). The characteristic handle is returned on the RXCharHandle
See the BLE stack API documentation for more information on these and following commands.
UM2071
Peripheral and central device setup
variable.

8.1.3 Enter connectable mode

The server device uses GAP API commands to enter the general discoverable mode:
aci_gap_set_discoverable(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE,8,local_name, 0, NULL, 0, 0);
The local_name parameter contains the name presented in advertising data, as per Bluetooth core specification version 4.2, V
ol. 3, Part C, Ch. 11.

8.1.4 Connection with central device

Once the server device is discoverable by the BLE chat client device, the client device uses
aci_gap_create_connection()to connect with the BLE chat server device:
aci_gap_create_connection(0x4000, 0x4000, PUBLIC_ADDR, bdaddr, PUBLIC_ADDR, 40, 40, 0, 60, 20 00 , 2000);
Where bdaddr is the peer address of the client device.
Once the two devices are connected, you can set up corresponding serial terminals and type messages in either of them. The typed characters are stored in two respective buffers and when the return key is pressed:
on the BLE chat server device, the typed characters are sent to the BLE chat client device by notifying the
previously added TX characteristic (after notifications are enabled) with:
aci_gatt_update_char_value(chatServHandle,TXCharHandle,0,len, (uint8_t*)cmd+j);
on the BLE chat client device, the typed characters are sent to the BLE chat server device by writing the
previously added RX characteristic with:
UM2071 - Rev 12
aci_gatt_write_without_resp(connection_handle, rx_handle+1, len, (uint8_t *)cmd+j);
Where connection_handle is the handle returned upon connection as a parameter of the connection complete event, rx_handle is the RX characteristic handle discovered by the client device.
Once these API commands have been sent, the values of the TX and RX characteristics are displayed on the serial terminals.
page 24/94
Figure 20. BLE chat client
Figure 21. BLE chat server
UM2071
Peripheral and central device setup
UM2071 - Rev 12
page 25/94
BLE chat master and slave demo application

9 BLE chat master and slave demo application

The BLE chat master and slave demo is supported on the BlueNRG-1, BlueNRG-2development platforms (STEV
AL-IDB007Vx, STEV
communication using a single application which configures the chat client and server roles at runtime.
The new chat demo application configures a BLE device as central or peripheral using the API:
aci_gap_init(GAP_CENTRAL_ROLE|GAP_PERIPHERAL_ROLE, 0, 0x07, &service_handle, &dev_name_char_h andle, &appearance_char_handle);
It then initiates a discovery procedure for another BLE device configured with the same chat master and slave application image.
If such a device is found within a random interval, it starts a connection procedure and waits until a connection is established. If the discovery procedure time expires without finding another chat master and slave device, the device enters discovery mode and waits for another chat master and slave device to discover and connect to it.
When connection is established, the client and server roles are defined and the chat communication channel can be used.
This demo application exposes a single chat service with the following (20 byte max.) characteristic values:
The TX characteristic, with which the client can enable notifications; when the server has data to be sent, it sends notifications with the value of the TX characteristic.
The RX characteristic, is a writable characteristic; when the client has data to be sent to the server, it writes
a value in this characteristic.
The application requires two devices to be programmed with the same application, with the server and client roles defined at runtime. Connect the two devices to a PC via USB and open a serial terminal on both with the same configuration as T
The application listens for keys typed in one device terminal and sends them to the remote device when the return key is pressed; the remote device then outputs the received RF messages to the serial port. Therefore, anything typed in one terminal becomes visible in the other.
able 6. Serial port configuration.
AL-IDB008Vx, STEV
AL-IDB009Vx). It demonstrates simple point-to-point wireless
UM2071

9.1 BLE chat master and slave roles

This section describes how two BLE chat master and slave devices interact with each other in order to set up a point-to-point wireless chat.
The BLE stack must first be set up on both devices by sending a series of API commands to the processor chat master and slave client and server roles are defined at runtime.

9.1.1 Initialization

The BLE stack must be correctly initialized before establishing a connection with another BLE device. This is done with two commands:
aci_gatt_init();
aci_gap_init(GAP_CENTRAL_ROLE|GAP_PERIPHERAL_ROLE, TRUE,0x07, &service_handle, &dev_name_char _handle, &appearance_char_handle);
The BLE peripheral and central roles are specified in the aci_gap_init() command. See the BLE API documentation for more information on these and following commands.

9.1.2 Add service and characteristics

Refer to Section 8.1.2 Add service and characteristics.

9.1.3 Start discovery procedure

To find another BLE chat master and slave device in discovery mode, a discovery procedure must be started via:
aci_gap_start_general_discovery_proc(0x4000, 0x4000, 0x00, 0x00);
. The
UM2071 - Rev 12
page 26/94

9.1.4 Enter connectable mode

The following GAP API command is used for entering general discoverable mode:
aci_gap_set_discoverable(ADV_IND, 0x90, 0x90, PUBLIC_ADDR, NO_WHITE_LIST_USE, sizeof(local_na me), local_name, 0, NULL, 0x6, 0x8);

9.1.5 Connection with chat master and slave client device

In the above mentioned discovery and mode assignment procedures, the two chat master and slave applications assume respective client and server roles at runtime. During this initial configuration phase, when a chat master and slave device is placed in discoverable mode and it is found by the other chat master and slave device performing a discovery procedure, a Bluetooth low energy connection is created and the device roles are defined.
The following GAP API command is used for connecting to the discovered device:
aci_gap_create_connection(0x4000, 0x4000,device_found_address_type, device_found_address, PUB LIC_ADDR, 40, 40, 0, 60, 2000 , 2000);
Where device_found_address_type is the address type of the discovered chat master and slave and device_found_address is the peer address of the discovered chat master and slave device.
Once the two devices are connected, you can set up corresponding serial terminals and type messages in either of them. The typed characters are stored in two respective buf
On the BLE chat master-and-slave server device, the typed characters are sent to the master-and-slave client device by notifying the previously added TX characteristic (after notifications have been enabled). This is done via:
UM2071
BLE chat master and slave roles
fers and when the return key is pressed:
aci_gatt_update_char_value(chatServHandle, TXCharHandle, 0, len, (uint8_t *)cmd+j);
On the master-and-slave client device, the typed characters are sent to the master-and-slave server device, by writing the previously added RX characteristic. This is done via:
aci_gatt_write_without_resp (connection_handle, rx_handle +1, len, (uint8_t *)cmd+j);
Where connection_handle is the handle returned upon connection as a parameter of the connection complete event, rx_handle is the RX characteristic handle discovered by the client device.
Once these API commands have been sent, the values of the TX and RX characteristics are displayed on the serial terminals.
UM2071 - Rev 12
page 27/94

10 BLE remote control demo application

UM2071
BLE remote control demo application
The BLE remote control application is supported on the BlueNRG-1, BlueNRG-2
AL-IDB007Vx, STEV
(STEV (like an actuator) using a BlueNRG-1, BlueNRG-2 device.
This application periodically broadcasts temperature values that can be read by any device. The data is encapsulated in a manufacturer-specific AD type and the content (besides the manufacturer ID, i.e., 0x0030 for STMicroelectronics) is as follows:
Byte 0 Byte 1 Byte2
App ID (0x05) Temperature value (little-endian)
The temperature value is given in tenths of degrees Celsius.
The device is also connectable and exposes a characteristic used to control LEDs DL1 and DL3 on the BLE kit platform. The value of this characteristic is a bitmap of 1 byte. Each bit controls one of the LEDs:
bit 0 is the status of LED DL1
bit 2 is the status of LED DL3.
A remote device can therefore connect and write this byte to change or read the status of these LEDs (1 for LED ON, 0 for LED OFF).
The peripheral disconnects after a timeout (DISCONNECT_TIMEOUT) to prevent a central device remaining connected to the device indefinitely.
Security is not enabled by default, but this can be changed with ENABLE_SECURITY (refer to file BLE_RC_main.h). When security is enabled, the central device must be authenticated before reading or writing the device characteristic.
To interact with a device configured as a BLE remote control, another BLE device (a BlueNRG-1, BlueNRG-2 or any Bluetooth® Low Energy device) can be used to detect and view broadcast data.
To control one of the LEDs, the device has to connect to a BlueNRG-1 BLE remote control device and write in the exposed control point characteristic. The Service UUID is ed0ef62e-9b0d-11e4-89d3-123b93f75cba. The control point characteristic UUID is ed0efb1a-9b0d-11e4-89d3-123b93f75cba.
AL-IDB008Vx, STEVAL-IDB009Vx). It demonstrates how to control a remote device
Table 7. BLE remote advertising data
development platforms

10.1 BLE remote control application setup

This section describes how to configure a BlueNRG-1

10.1.1 Initialization

The BLE stack must be correctly initialized before establishing a connection with another Bluetooth LE device. This is done with two commands:
aci_gatt_init(); aci_gap_init(GAP_PERIPHERAL_ROLE, 0, 0x07, &service_handle, &dev_name_char_handle, &appearanc e_char_handle);
See BLE stack API documentation for more information on these and following commands.

10.1.2 Define advertising data

The BLE remote control application advertises certain manufacturing data as follows:
UM2071 - Rev 12
device to acting as a remote control device.
page 28/94
/* Set advertising device name as Node */ const uint8_t scan_resp_data[] = {0x05,AD_TYPE_COMPLETE_LOCAL_NAME,'N','o','d','e'} /* Set scan response data */ hci_le_set_scan_response_data(sizeof(scan_resp_data),scan_resp _data); /* Set Undirected Connectable Mode */ aci_gap_set_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/625, (ADV_INTERVAL_MAX_MS*1000)/625, PUBLIC_ADDR, NO_WHITE_LIST_USE, 0, NULL, 0, NULL, 0, 0); /* Set advertising data */ hci_le_set_advertising_data(sizeof(adv_data),adv_data);
On the development platform, the temperature sensor value is set in the adv_data variable.

10.1.3 Add service and characteristics

The BLE Remote Control service is added via:
aci_gatt_add_service(UUID_TYPE_128, &service_uuid, PRIMARY_SERVICE, 7, &RCServHandle);
Where service_uuid is the private service 128-bit UUID allocated for the BLE remote service (ed0ef62e-9b0d-1
The command returns the service handle in RCServHandle.
The BLE remote control characteristic is added using the following command:
1e4-89d3-123b93f75cba).
UM2071
BLE remote control application setup
#if ENABLE_SECURITY aci_gatt_add_char(RCServHandle, UUID_TYPE_128, &controlPointUuid, 1, CHAR_PROP_READ|CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP|CH AR_PROP_SIGNED_WRITE, ATTR_PERMISSION_AUTHEN_READ|ATTR_PERMISSION_AUTHEN_WRITE, GATT_NOTIFY_ATTRIBUTE_WRITE,16,1,&c ontrolPointHandle); #else aci_gatt_add_char(RCServHandle, UUID_TYPE_128, &controlPointUuid, 1, CHAR_PROP_READ|CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_NOTIF Y_ATTRIBUTE_WRITE, 16, 1,&controlPointHandle); #endif
Where controlPointUuid is the private characteristic 128-bit UUID allocated for BLE remote control characteristic (ed0efb1a-9b0d-1
1e4-89d3-123b93f75cba) and controlPointHandle is the BLE remote control
characteristic handle.
If security is enabled, the characteristic properties must be set accordingly to enable authentication on controlPointUuid characteristic read and write.

10.1.4 Connection with a BLE Central device

When connected to a BLE central device (another BlueNRG-1, device), the controlPointUuid characteristic is used to control the BLE remote control platform LED. Each time a write operation is performed on controlPointUuid, the aci_gatt_attribute_modified_event() callback is raised and the selected LEDs are turned on or of
BlueNRG-2 device or any Bluetooth® Low Energy
f.
UM2071 - Rev 12
page 29/94
Loading...
+ 65 hidden pages