background image

UM2264 

BlueNRG-1 sensor

 profile central demo 

 

 

DocID030868 Rev 1 

37/55 

 

11 

BlueNRG-1 sensor profile central demo 

The BlueNRG-1 sensor profile central demo is supported on the BlueNRG-1 or SPBTLE-
1S development platforms (STEVAL-IDB007V1 or STEVAL-IDB007V1M). It implements a 
basic version of the BlueNRG-1 BLE Sensor Profile Central role which emulates the 
BlueNRG-1 Sensor Demo applications available for smartphones (iOS and Android). 

This application configures a BlueNRG-1 device as a BlueNRG-1 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-1 development platform 
configured as a BlueNRG-1 Sensor device, Peripheral role (refer to 

Section 10: "BlueNRG-

1 sensor profile demo"

). 

This application uses a new set of APIs allowing to perform the following operations on a 
BlueNRG-1 Master/Central device:  

 

Master Configuration Functions 

 

Master Device Discovery Functions 

 

Master Device Connection Functions 

 

Master Discovery Services, Characteristics Functions 

 

Master Data Exchange Functions 

 

Master Security Functions 

 

Master Common Services Functions 

These APIs are provided through a binary library and they are fully documented on 
available doxygen documentation within the BlueNRG-1 DK SW package. The following 
master/central binary libraries are provided on 
Bluetooth_LE\Profile_Framework_Central\library folder: 

 

master_library_bluenrg1.lib for IAR and Keil toolchains 

 

libmaster_library_bluenrg1.a for Atollic toolchain 

Summary of Contents for BlueNRG-1

Page 1: ...les The available kit is the STEVAL IDB007V1M development platform order code STEVAL IDB007V1M The STEVAL IDB007V1M provides a set of hardware resources for a wide range of application scenarios sensor data accelerometer pressure and temperature sensor remote control buttons and LEDs and debug message management through USB virtual COM Three power options are available USB only battery only and ex...

Page 2: ...dware setup 13 3 BlueNRG 1 Navigator 14 3 1 BlueNRG 1 Navigator Demonstration Applications 14 3 1 1 BlueNRG 1 Navigator Basic examples 16 3 1 2 BlueNRG 1 Navigator BLE demonstration and test applications 16 3 1 3 BlueNRG 1 Navigator Peripherals driver examples 17 3 2 BlueNRG 1 Navigator Development Kits 18 3 2 1 BlueNRG 1 Navigator Release Notes and License 18 4 BlueNRG 1 Flasher utility 19 4 1 Ho...

Page 3: ...characteristics 31 8 1 3 Start discovery procedure 31 8 1 4 Enter connectable mode 31 8 1 5 Connection with chat master and slave client device 31 9 BlueNRG 1 remote control demo application 32 9 1 BLE remote control application setup 32 9 1 1 Initialization 32 9 1 2 Define advertising data 33 9 1 3 Add service and characteristics 33 9 1 4 Connection with a BLE Central device 33 10 BlueNRG 1 senso...

Page 4: ...idirectional throughput scenario 39 14 BLE notification consumer demonstration application 41 15 BlueNRG 1 peripheral driver examples 42 15 1 ADC examples 42 15 2 GPIO examples 42 15 3 I C examples 43 15 4 Micro examples 43 15 5 RTC examples 44 15 6 SPI examples 44 15 7 SysTick examples 45 15 8 Timers examples 45 15 9 UART examples 47 15 10 WDG examples 47 16 Schematic diagrams 48 17 Revision hist...

Page 5: ...E 1S module pin description with board functions 9 Table 3 STEVAL IDB007V1M kit platform power supply modes 11 Table 4 STEVAL IDB007V1M kit platform jumpers 11 Table 5 BlueNRG 1 Beacon advertising manufacturing data 25 Table 6 Serial port configuration 27 Table 7 BLE remote advertising data 32 Table 8 Document revision history 54 ...

Page 6: ...e selection 21 Figure 14 BlueNRG 1 Flasher utility image file viewer 21 Figure 15 BlueNRG 1 Flasher utility device memory viewer 22 Figure 16 BlueNRG 1 Flasher utility changing memory fields 22 Figure 17 BlueNRG 1 Flasher utility Comport Setting popup 23 Figure 18 BLE chat client 29 Figure 19 BLE chat server 29 Figure 20 BLE sensor demo GATT database 34 Figure 21 BlueNRG sensor app 35 Figure 22 ST...

Page 7: ...s Windows XP SP3 Windows Vista Windows 7 At least 128 MB of RAM USB ports At least 40 MB of available hard disk space Adobe Acrobat Reader 6 0 or later 1 3 BlueNRG 1 development kit setup After downloading the BlueNRG 1 DK software package STSW BLUENRG1 DK from www st com extract BlueNRG 1_DK x x x Setup zip contents to a temporary directory launch BlueNRG 1 DK x x x Setup exe and follow the on sc...

Page 8: ...integrated antenna 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 SMA connector for antenna or measuring equipment 3 user LEDs 2 user buttons 3D digital accelerometer and 3D digital gyroscope MEMS pressure sensor with embedded temperature sensor Battery ho...

Page 9: ...ween STM32 and SPBTLE 1S Notes 1 STM32 is not intended to be programmed by users 2 2 SPBTLE 1S module connections The SPBTLE 1S module containing the very low power Bluetooth low energy BLE single mode system on chip Figure 2 STEVAL IDB007V1M board components region A has 160 KB 256 KB of Flash 24 KB of RAM a 32 bit core ARM Cortex M0 processor and several peripherals ADC GPIOs I C SPI Timers UART...

Page 10: ...L1 pin 7 IO6 pin 5 SDA DIO5 4 SDA PUSH2 button pin 9 SDA DIO4 3 SCL pin 10 SCL DIO3 17 SDO SA0 pin 5 MIS O pin 6 IO5 DIO2 16 SDA pin 4 MOS I pin 5 IO4 DIO1 18 CS JTAG TDO pin 3 CS DIO0 15 SCL JTAG TDI pin 6 SCK pin 4 IO3 ANATES T0 DIO14 6 DL3 pin 4 AD3 ANATES T1 14 ADC1 2 ADC2 1 VBAT 5 RESETN 19 RESET RESET RESET pin 3 NRST pin 8 IO7 DIO13 PUSH1 pin 3 AD2 DIO12 20 INT1 pin 1 AD0 DIO11 11 RXD PA3 p...

Page 11: ...nents region C 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 USB supply through connector CN5 for STM32L1 JP2 pin 2 external power for SPBTLE 1S 2 4 Jumpers The following jumpers are available Table 4 STEVAL IDB007V1M kit platform jumpers Jumper Description JP1 1 2 to provide power from USB JP2 2 3 Open 3 to provide po...

Page 12: ... ST LINK V2 Only SWD mode is supported 2 9 LEDs LEDs DL1 yellow DL2 red DL3 blue and DL4 green power LED are available on the board Figure 2 STEVAL IDB007V1M board components regions G and P 2 10 STM32L151CBU6 microcontroller The most important feature of the STM32L151CBU6 48 pin microcontroller Figure 2 STEVAL IDB007V1M board components regions Q is the USB to serial bridge providing an I O chann...

Page 13: ...2 12 Hardware setup 1 Configure the board to USB power supply mode as per the jumper settings in Table 3 STEVAL IDB007V1M kit platform power supply modes 2 Connect the board to a PC via USB cable connector CN5 3 Verify the power indication LED DL4 is on ...

Page 14: ...ge BLE examples or peripheral driver example on the BlueNRG 1 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 Navigator icon under Start STMicroelectronics BlueNRG 1 DK X X X BlueNRG 1 Navigator Figure 3 BlueNRG 1 Navigator 3 1 BlueNRG 1 Navigator Demonstration Applic...

Page 15: ...he 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 4 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 o...

Page 16: ... SPBTLE 1S or BlueNRG 1 device to verify that BlueNRG 1 device is alive as well as the device sleep and wakeup modes Figure 7 Basic examples 3 1 2 BlueNRG 1 Navigator BLE demonstration and test applications This page lists all the available Bluetooth low energy BLE demonstration applications in the BlueNRG 1 DK software package These applications provide usage examples of the BLE stack features fo...

Page 17: ... applications 3 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 SPBTLE 1S based on BlueNRG 1 peripheral Figure 9 Peripherals driver examples ...

Page 18: ...ng resources When you hover the mouse pointer over a specific item the related component is highlighted on the board Figure 10 STEVAL IDB007V1M Kit components 3 2 1 BlueNRG 1 Navigator Release Notes and License As their name suggests these pages display the BlueNRG 1 DK SW package Release Notes html format and the BlueNRG 1 DK software package license file respectively ...

Page 19: ...1 How to run The BlueNRG 1 Flasher utility PC configuration requires the following minimum characteristics a PC with USB port running Windows XP or Windows 7 at least 256 MB of RAM at least 30 MB of free hard disk space You can run this utility by clicking on the BlueNRG 1Flasher icon under Start STMicroelectronics BlueNRG 1DK X X X BlueNRG1 Flasher Figure 11 BlueNRG 1 Flasher utility ...

Page 20: ...ct the COM port to be used to interface the device Port dropdown list The SPBTLE 1S module or BlueNRG 1 device memory is read when the associated COM port is opened Figure 12 BlueNRG 1 Flasher utility main window 4 2 1 Main menu items From the File menu you can 1 Load an existing bin or hex Intel extended file 2 Save the current memory image in a bin file The start address and the size of the memo...

Page 21: ... memory pages are erased and written with the file content When this option is checked the memory flash phase is preceded by a full mass erase The Verify option forces a check to ensure that the memory content has been written correctly Check the Update memory table option to update the Device Memory table after the flashing operation This option is automatically checked when the Verify checkbox i...

Page 22: ...es appear in red Click the Write button to flash the entire page with the new byte values into device memory Figure 16 BlueNRG 1 Flasher utility changing memory fields 4 2 5 Using BlueNRG 1 Flasher utility with other boards The BlueNRG 1 Flasher utility automatically detects SPBTLE 1S evaluation boards like STEVAL IDB007V1M and uses an auxiliary STM32 driven by the GUI to reset the BlueNRG 1 and p...

Page 23: ...PBTLE 1S or BlueNRG 1 device keeping the DIO7 high the device should now be in bootloader mode You can also set a preferred baudrate for the UART in the popup window and then press OK to return to the GUI Avoid resetting the device while using the BlueNRG 1 Flasher utility unless the Comport Setting popup is active If the device is reset you must toggle the COM port to use the Flasher utility agai...

Page 24: ... directories Application containing BlueNRG 1 Navigator and Flasher PC applications Doc with doxygen BLE APIs and events BlueNRG 1 peripheral drivers BLE demo applications BlueNRG 1 Peripheral examples BlueNRG 1 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 sta...

Page 25: ... 6 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 SIG company identifier 1 Default is 0x0030 STMicroelectronics ID Beacon ID Fixed value Location UUID Beacons UUID Used to distinguish specific beacons from others Major number Identifier fo...

Page 26: ...facturing 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...

Page 27: ...e 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 Table 6 Serial port configuration 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 ...

Page 28: ...hat server device aci_gatt_add_char chatServHandle UUID_TYPE_128 charUuidRX 20 CHAR_PROP_WRITE CHAR_PROP_WRITE_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 variable See the BlueNRG 1 BLE stack API docu...

Page 29: ...the typed characters are sent to the BLE chat server device by writing the previously added RX characteristic with 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 ...

Page 30: ...es 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 th...

Page 31: ... 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 PUBLIC_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 ...

Page 32: ...o 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 wr...

Page 33: ... service handle in RCServHandle The BLE remote control characteristic is added using the following command 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 controlPointHandle else aci_gatt_add...

Page 34: ...ree fall characteristic cannot be read or written but can be signaled The application sends notification of this characteristic with a value of 0x01 if a free fall condition is detected by the MEMS sensor when the acceleration on the three axes is near zero for a certain amount of time Notifications can be enabled or disabled by writing the associated client characteristic configuration descriptor...

Page 35: ...ibes how to interact with a central device while the BlueNRG 1 BLE stack is acting as a peripheral The central device may be another BlueNRG 1 device acting as a BLE master or any other Bluetooth smart or Bluetooth smart ready device The BlueNRG 1 BLE stack must first be set up by sending a series of BLE API commands to the processor 10 2 1 Initialization The BlueNRG 1 BLE stack must be correctly ...

Page 36: ...ERVAL_MIN_MS 1000 625 ADV_INTERVAL_MAX_MS 1000 625 STATIC_RANDOM_ADDR NO_WHITE_LIST_USE sizeof local_name local_name 0 NULL 0 0 Where local_name AD_TYPE_COMPLETE_LOCAL_NAME B l u e N R G The local_name parameter contains the name presented in advertising data as per Bluetooth core specification version Vol 3 Part C Ch 11 10 2 4 Connection with central device Once the BlueNRG 1 BLE stack is placed ...

Page 37: ...development platform configured as a BlueNRG 1 Sensor device Peripheral role refer to Section 10 BlueNRG 1 sensor profile demo This application uses a new set of APIs allowing to perform the following operations on a BlueNRG 1 Master Central device Master Configuration Functions Master Device Discovery Functions Master Device Connection Functions Master Discovery Services Characteristics Functions...

Page 38: ...d for two minutes it closes the connection and enters deep sleep mode This idle connection timeout can be changed from the application To exit deep sleep mode press the left PUSH1 button or reset the platform 12 2 BLE HID HOGP keyboard demonstration application The BlueNRG 1 HID keyboard application implements a basic HID keyboard compliant with the standard HID HOGP BLE application profile The HI...

Page 39: ... characteristics BLE peripheral device 2 Client which uses the service TX RX characteristics BLE central device Each device role has two instances for each throughput scenario unidirectional bidirectional The BlueNRG 1 throughput demonstration applications are supported by the BlueNRG 1 development platform STEVAL IDB007V1 13 1 BLE unidirectional throughput scenario The unidirectional throughput s...

Page 40: ...directional application on a second BLE platform and reset it Open the related port in a serial terminal emulator the required serial port baudrate is 921600 The two platforms try to establish a connection if successful the slave device continuously sends notifications of TX characteristic 20 bytes to the client device and the client device continuously sends write without responses of the RX char...

Page 41: ...vice in advertising with device name ANCSdemo and sets the BlueNRG 1 authentication requirements to enable bonding When the device is connected and bonded with a notification provider the demo configures the BlueNRG 1 notification consumer device to discover the service and the characteristics of the notification provider When the setup phase is complete the BlueNRG 1 device is configured as a not...

Page 42: ...1 DK SW package ADC PDM doxygen documentation for HW connections setup User is requested to connect the BlueNRG 1 STEVAL IDB007V1 to a PC USB port and open PuTTY serial terminal 512000 8 N 1 N PuTTY serial terminal has to be configured for storing the captured data on a log file After the data have been captured the PC Audacity tool can been opened for importing the streamed data following these s...

Page 43: ...olled by polling the I C status register content This also involves a master and a slave board with respective Master_Polling and Slave_Polling firmware The slave board receives read and change requests for the LEDs via I C Master sensor I C communication is controlled by polling of I C status register content interrupts or DMA three different configurations In this example the environmental senso...

Page 44: ...tting The pattern size is set to 8 bits and the pattern is set to 0b11110010 so the RTC generates four intervals with the RTC_TLR1 value followed by two RTC_TLR2 value intervals The pattern repeats itself and the RTC interrupt routine toggles LED DL1 IO6 15 6 SPI examples The following SPI application examples are available Master polling involves a master board with the Master_Polling firmware co...

Page 45: ...s examples Mode 1 Timer Counter 1 TnCNT1 functions as the time base for the PWM timer and counts down at the clock rate selected by the Timer Counter 1 clock selector When an underflow occurs the timer register is reloaded alternately from the TnCRA first reload and TnCRB registers and count down begins from the loaded value Timer Counter 2 can be used as a simple system timer an external event co...

Page 46: ...duty cycle PWM signal on the TnA pin while the TnB pin can be used as an external event input or pulse accumulate input and serve as the clock source to either Timer Counter 1 or Timer Counter 2 Both counters can also be operated from the prescaled system clock In this example MFTX1 is used The CPU clock is selected as the clock signal for Timer Counter 1 while Timer Counter 2 uses an external clo...

Page 47: ...urement If the IO13 pin state does not change during this interval the watchdog generates an interrupt that is intentionally not cleared and therefore remains pending the watchdog interrupt service routine is therefore called continuously and the system is stuck in the watchdog interrupt handler The chip is reset as it can no longer execute user code The second watchdog timeout triggers system reb...

Page 48: ...Schematic diagrams UM2264 48 55 DocID030868 Rev 1 16 Schematic diagrams Figure 22 STEVAL IDB007V1M Arduino connectors Figure 23 STEVAL IDB007V1M JTAG ...

Page 49: ...UM2264 Schematic diagrams DocID030868 Rev 1 49 55 Figure 24 STEVAL IDB007V1M SPBTLE 1S module BlueNRG 1 ...

Page 50: ...Schematic diagrams UM2264 50 55 DocID030868 Rev 1 Figure 25 STEVAL IDB007V1M power management and sensors ...

Page 51: ...UM2264 Schematic diagrams DocID030868 Rev 1 51 55 Figure 26 STEVAL IDB007V1M buttons and LEDs ...

Page 52: ...Schematic diagrams UM2264 52 55 DocID030868 Rev 1 Figure 27 STEVAL IDB007V1M STM32 microprocessor ...

Page 53: ...UM2264 Schematic diagrams DocID030868 Rev 1 53 55 Figure 28 STEVAL IDB007V1M USB level translator JTAG for micro Figure 29 STEVAL IDB007V1M EEPROM SWITCH ...

Page 54: ...Revision history UM2264 54 55 DocID030868 Rev 1 17 Revision history Table 8 Document revision history Date Version Changes 25 Jul 2017 1 Initial release ...

Page 55: ...asers are solely responsible for the choice selection and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property right is granted by ST herein Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product S...

Reviews: