Page 1
There are two types of BlueNRG kits: BlueNRG development platform (order code: STEVAL-IDB002V1) BlueNRG USB dongle (order code: STEVAL-IDB003V1) The BlueNRG software package includes a graphical user interface application to control the BlueNRG through a simple ACI protocol. December 2015...
UM1686 Getting started Getting started This section describes all the software and hardware requirements for running the BlueNRG GUI utility as well as the related installation procedure. STEVAL-IDB002V1 kit contents This kit is composed of the following items: • 1 development motherboard •...
Getting started UM1686 Figure 2. STEVAL-IDB003V1 BlueNRG USB dongle System requirements The BlueNRG graphical user interface utility has the following minimum requirements: • ® ® ® PC with Intel or AMD processor running one of the following Microsoft operating systems: –...
The motherboard included in the development kit allows testing of the functionality of the BlueNRG processor. The board can be used as a simple interface between the BlueNRG and a GUI application on the PC. The STM32L microcontroller on the board can also be programmed, so the board can be used to develop applications using the BlueNRG.
Hardware description UM1686 Figure 3. Motherboard for the BlueNRG development kit 2.1.1 Microcontroller and connections The board features an STM32L151RB microcontroller, which is an ultra low-power microcontroller with 128 KB of Flash memory, 16 KB of RAM, 32-bit core ARM cortex-M3, 4 KB of data EEPROM, RTC, LCD, timers, USART, I C, SPI, ADC, DAC and comparators.
Page 9
UM1686 Hardware description Table 1. MCU pin description versus board function (continued) Board function Buttons / Temperatur Ext. name LEDs DB connector Acceler. JTAG joystick e sensor conn VSSA VDDA VSS_4 VDD_4 SPI1_NSS SPI1_SCK SPI1_MISO SPI1_MOSI LED4 LED5 JOY_DOW JOY_RIGH PB10 INT1 PB11...
The STM32L is preprogrammed with a DFU firmware that allows the downloading of a firmware image without the use of a programmer. If an user accidentally erases DFU firmware, he can reprogram it through STLink using the hex image DFU_Bootloader.hex available on BlueNRG DK SW package, firmware folder. DocID025464 Rev 5...
(Figure 4) included in the development kit is a small circuit board to be connected to the main board. It contains the BlueNRG network processor (in a QFN32 package), an SMA antenna connector, discrete passive components for RF matching and balun, and small number of additional components required by the BlueNRG...
To monitor power consumption of the entire BlueNRG daughterboard, remove the jumper from U2 and insert an ammeter between pins 1 and 2 of the connector. Since power consumption of the BlueNRG during most operation time is very low, an accurate instrument in the range of few microamps may be required.
STEVAL-IDB003V1 USB dongle The BlueNRG USB dongle allows users to easily add BLE functionalities to their PC by plugging it into a USB port. The USB dongle can be used as a simple interface between the BlueNRG and a GUI application on the PC. The on-board STM32L microcontroller can also be programmed, so the board can be used to develop applications that use the BlueNRG.
Page 15
UM1686 Hardware description Table 4. MCU pin description versus board function Board function Pin name num. LEDs BlueNRG Buttons VLCD VBAT PC13 PC14 PC15 OSC_IN OSC_OUT NRST VSS_A VDD_A Button SW2 Led D2 Led D3 Button SW1 PB10 BlueNRG_IRQ PB11...
STM32L microcontroller on the board, using an in-circuit debugger and programmer like the ST-LINK/V2. In Figure 5 the connection scheme illustrating how to connect the ST-LINK/V2 with the board pins is shown. Figure 5. SWD connection scheme with ST-LINK/V2 16/70 DocID025464 Rev 5...
UM1686 Hardware description The signals available on the STEVAL-IDB003V1 are: nRESET SWDIO SWO/TRACE SWCLK The connection to the ST-LINK/V2 interface is given in the table below, as shown in Figure Table 5. SWD connection STEVAL-IDS001Vx ST-LINK/V2 Signal name pin number...
SW1 is the DFU button. The BlueNRG USB dongle is preprogrammed with a DFU application allowing upgrades to the STM32L firmware image through USB and using the BlueNRG GUI. To activate the DFU, press button SW1 and plug the BlueNRG USB dongle into a PC USB port.
In this way BlueNRG can be easily managed at low level. Requirements In order to use the BlueNRG GUI, make sure you have correctly set up your hardware and software (BlueNRG GUI installed). The STM32L in the STEVAL-IDB002V1 kit has been preprogrammed with a demo application (see Section 5).
3.2.1 GUI main window Figure 7. BlueNRG GUI main window The BlueNRG GUI main window is characterized by different zones. Some of these zones can be resized. Port and interface selection The uppermost zone allows the user to open the COM port associated to the BTLE controller.
Page 21
UM1686 GUI software description The command packet table contains four columns: • Parameter: name of the packet field as they are named in volume 2, part E of Bluetooth specification. • Value: field value represented in hexadecimal format (right-click on a cell to change its representation format).
GUI, Tools, BlueNRG IFR... item. The BlueNRG GUI IFR utility is a tool that allow the customer to define the IFR data in a controller way. Using this utility is the only supported mode to define IFR data based on customer needs.
Page 23
UM1686 GUI software description Figure 11. BlueNRG GUI IFR tool: View/Edit view In the View/Edit view, the following operations are available: • Select the high speed (HS) crystal (16 or 32 MHz) and the low speed oscillator source (32 kHz or the internal ring oscillator) •...
Page 24
This data is stored in the EEPROM on the daughterboard. Get version The Get version tool is used to retrieve the version of the BlueNRG GUI firmware (VCOM) on the STM23L, and hardware and firmware version from the BlueNRG.
GUI software description 3.2.3 GUI ACI utilities window The BlueNRG GUI ACI utilities window provides several tabs to allow testing of some BlueNRG application scenarios. Figure 12. BlueNRG GUI ACI utilities window Central and Peripheral roles are supported with the BLE operations described in...
Page 26
GUI software description UM1686 Table 6. GUI ACI utilities window: available general operations Operation Associated actions Notes Allows to initialize a device by selecting: - Role - Stack Mode (1,2,3); Init Device… - Address type (Public, Random) and value - Tx power level - Power mode - Device Name Allows to add a service by selecting:...
Page 27
UM1686 GUI software description Table 7. GUI ACI utilities window: available central operations Operation Associated actions Notes Allows to put device in scanning mode by selecting: - GAP Procedure (Limited, general, general-connection establishment and terminate general-connection establishment procedures) Scanning - Enable or Disable filters - Set own address type - Set passive or active scan - Set Scanning interval and Window...
The GUI Scripts window allows the user to load and run a Python script built using the available set of BlueNRG ACI commands and the related events. For a list of supported HCI and ACI script commands and related parameters, refer to the commands available in the BlueNRG GUI ACI Commands window.
Page 29
UM1686 GUI software description Figure 13. BlueNRG GUI Scripts window Moreover, the script engine supports other utility commands: Table 9. GUI Scripts window: utility commands Command name Parameters Description HW_BOOTLOADER None Hardware bootloader activation HW_RESET None HW reset Opens a message window and shows the input...
Page 30
Returns the time as a floating point number TIME None expressed in seconds since the epoch, in UTC The following pseudo code describes how to initialize a BlueNRG device as a peripheral using a simple Python script: # Reset BlueNRG HW_RESET()
Page 31
UM1686 GUI software description Table 10. WAIT_EVENT macro-command Command Description Parameters Return name Waits for an event with event_code = None (default) An event with its parameters 'Event Code' None, if a timeout occurs and the parameterequal to timeout = None (default) input parameter “continueOnEvtMiss”...
Page 32
GUI software description UM1686 Table 11. WAIT_EVENT: event codes with related event parameter types (continued) Event event_code Event parameter type value parameter type ACI_BLUE_INITIALIZED_EVENT ACI_GAP_LIMITED_DISCOVERABLE_EVENT ACI_GAP_PAIRING_COMPLETE_EVENT ACI_GAP_PASS_KEY_REQ_EVENT ACI_GAP_AUTHORIZATION_REQ_EVENT ACI_GAP_SLAVE_SECURITY_INITIATED_EVENT ACI_GAP_BOND_LOST_EVENT ACI_GAP_DEVICE_FOUND_EVENT ACI_GAP_PROC_COMPLETE_EVENT ACI_L2CAP_CONNECTION_UPDATE_RESP_EVENT ACI_L2CAP_PROC_TIMEOUT_EVENT ACI_L2CAP_CONNECTION_UPDATE_REQ_EVENT ACI_GATT_ATTRIBUTE_MODIFIED_EVENT ACI_GATT_PROC_TIMEOUT_EVENT ACI_ATT_EXCHANGE_MTU_RESP_EVENT ACI_ATT_FIND_INFO_RESP_EVENT HCI_VENDOR_EVENT Ecode ACI_ATT_FIND_BY_TYPE_VALUE_RESP_EVENT ACI_ATT_READ_BY_TYPE_RESP_EVENT...
Page 33
UM1686 GUI software description Table 11. WAIT_EVENT: event codes with related event parameter types (continued) Event event_code Event parameter type value parameter type HCI_READ_REMOTE_VER SION_INFORMATION_COM PLETE_EVENT HCI_COMMAND_COMPLE TE_EVENT HCI_COMMAND_STATUS_ EVENT HCI_HARDWARE_ERROR_ EVENT HCI_NUMBER_OF_COMPL ETED_PACKETS_EVENT HCI_DATA_BUFFER_OVER FLOW_EVENT HCI_ENCRYPTION_KEY_R EFRESH_COMPLETE_EVE Below are some code examples using the WAIT_EVENT() macro-command: Example 1 # Wait any events evt = WAIT_EVENT()
Page 34
# Store the connection handle conn_handle= event.get_param('Connection_Handle').val # User defined code … GUI script engine loading and running steps To load and run a Python script using the BlueNRG GUI script engine, the following steps must be observed: 34/70 DocID025464 Rev 5...
GUI/scripts folder. Note: It is worthy of note that in order to write and use the BlueNRG scripts, the user is required to have some knowledge of the Python language (Python 2.7.6), and a good understanding of the BlueNRG ACI commands and related events.
Tx Power Level 2's complement of the Tx power device To configure a BlueNRG platform as a BLE beacon device, click on “Set Beacon” tab. 3.2.6 GUI RF Test window The BlueNRG GUI provides the RF Test window that permits the performance of the...
Page 37
Figure 15. GUI RF test: Start a tone Direct Test Mode (DTM) tests The BlueNRG GUI provides an RF test using the BLE Direct Test Modes commands that allows users to target a packet error rate test scenario. Two sections are available:...
Page 38
Connect two BlueNRG platforms (TX and RX) to PC USB ports Open two instances of BlueNRG GUI (one for TX and RX BlueNRG devices) In each instance of the BlueNRG GUI, Open the COM port related to TX/RX BlueNRG device...
Page 39
UM1686 GUI software description Stop PER test In the BlueNRG GUI related to TX BlueNRG device, – Go to the RF Test window, TRANSMITTER section – Click on “Stop Transmitter” button. The number of transmitted packets is displayed in the #Packet Transmitted field...
Programming with BlueNRG network processor Programming with BlueNRG network processor The BlueNRG provides a high level interface to control its operation. This interface is called ACI (application-controller interface). The ACI is implemented as an extension to the standard Bluetooth HCI interface. Since BlueNRG is a network processor, the stack runs inside the device itself.
Page 42
Drivers. It contains all the STM32L1xx Cube library framework files. – Middlewares\ST\STM32_BlueNRG\SimpleBlueNRG_HCI. Contains the code that is used to send ACI commands to the BlueNRG network processor. It contains also definitions of BlueNRG events. – platform. Contains all the platform-dependent files (only on STM32L1xx standard library framework).
Bluetooth profile: the sensor profile. This example is useful for building new profiles and applications that use the BlueNRG network processor. This GATT profile is not compliant to any existing specification. The purpose of this project is simply to show how to implement a given profile.
UM1686 Figure 20. BlueNRG sensor demo GATT database Supported platforms The BlueNRG sensor profile demo is supported only on the BlueNRG development platform (STEVAL-IDB002V1). BlueNRG app for smartphones An application is available for smartphones (iOS and android), that works with the sensor profile demo.
The central device can be another BlueNRG acting as a master, or any other Bluetooth smart or smart-ready device. First, BlueNRG must be set up. In order to do this, a series of ACI command need to be sent to the processor.
Start the LightBlue application. It will start to scan for peripherals. A device with the BlueNRG name will appear on the screen. Tap on the box to connect to the device. A list of all the available services will be shown on the screen. Touching a service will show the characteristics for that service.
BlueNRG Sensor Demo applications available for smartphones (iOS and Android). It configures a BlueNRG device as a BlueNRG Sensor device, Central role which is able to find, connect and properly configure the free fall, acceleration and environment sensor characteristics provided by a BlueNRG development platform, configured as a BlueNRG Sensor device, Peripheral role.
BlueNRG sensor profile demo UM1686 param variable allows to set the initialization parameters (device address, name, …). Refer to the master library doxygen documentation for more information about the command and related parameters. On the application main loop, the Master_Process() API has to be called in order to process the Master library state machines.
UM1686 BlueNRG sensor profile demo When the characteristics of a service are discovered, the Master_ServiceCharacPeerDiscovery_CB master library callback is called with GET_CHARACTERISTICS_OF_A_SERVICE code. In particular the sensor acceleration, free fall and temperature characteristics are discovered. 5.4.5 Enable sensor peripheral acceleration and free fall notifications...
6.2.3 Set security requirements BlueNRG exposes a command that the application can use to specify its security requirements. If a characteristic has security restrictions, a pairing procedure must be initiated by the central in order to access that characteristic. On BLE chat demo, a fixed pin...
BlueNRG chat demo application UM1686 aci_gap_set_auth_requirement(MITM_PROTECTION_REQUIRED,OOB_AUTH_DATA_AB SENT,NULL,7,16, USE_FIXED_PIN_FOR_PAIRING,123456,BONDING); 6.2.4 Enter connectable mode On BLE chat, server role device uses GAP ACI commands to enter into 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 that will be present in advertising data, as described in the Bluetooth core specification version 4.0, Vol.
Page 53
UM1686 BlueNRG chat demo application Figure 22. BLE chat client example Figure 23. BLE chat server example DocID025464 Rev 5 53/70...
The BlueNRG Beacon demo is supported by the BlueNRG development platform (STEVAL- IDB002V1) and the BlueNRG USB dongle (STEVAL-IDB003V1). BLE Beacon application setup This section describes how to configure a BlueNRG device for acting as a beacon device. 7.2.1 Initialization The BlueNRG stack must be correctly initialized as follows: –...
UM1686 BlueNRG Beacon demonstration application 7.2.3 Entering non-connectable mode The BLE Beacon device uses the GAP ACI command to enter non-connectable mode as follows: aci_gap_set_discoverable(ADV_NONCONN_IND, 160, 160, PUBLIC_ADDR, NO_WHITE_LIST_USE,0, NULL, 0, NULL, 0, 0); In order to advertise the specific selected manufacturer data, the BLE Beacon application...
BLE device (a BlueNRG or any SMART READY device) can be used to scan and see broadcast data. To control one of the LEDs, the device has to connect to a BlueNRG BLE Remote Control device and write into the exposed control point characteristic. The Service UUID is ed0ef62e-9b0d-11e4-89d3-123b93f75cba.
UM1686 BLE remote control demo application BLE remote control application setup This section describes how to configure a BlueNRG device to acting as a remote control device. 8.2.1 Initialization The BlueNRG's stack must be correctly initialized before establishing a connection with another Bluetooth LE device.
8.2.4 Connection with a BLE Central device When connected to a BLE Central device (another BlueNRG device or any SMART READY device), the controlPointUuid characteristic is used to control the BLE Remote Control platform LED. Each time a write operation is done on controlPointUuid, the EVT_BLUE_GATT_ATTRIBUTE_MODIFIED event is raised on the HCI_Event_CB () callback and the selected LED/LEDs are turned on or off.
UM1686 List of acronyms List of acronyms Table 16. List of acronyms used in this document Term Meaning Bluetooth low energy Information register Universal serial bus DocID025464 Rev 5 59/70...
Table 17. Document revision history Date Revision Changes 28-Nov-2013 Initial release – Added reference to the STEVAL-IDB003V1 BlueNRG USB Dongle – Added: Section 6 24-Apr-2014 – Added: Section 9 – Added: Section 10 – Minor text edits throughout the document –...
Page 70
ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgement.
Need help?
Do you have a question about the BlueNRG and is the answer not in the manual?
Questions and answers