| Bluetooth Low Energy scripts

SensorDemo_Central.py File Reference

## Detailed Description

This script configures a BLE device as a BLE Sensor device, Central role which is able to find, connect and properly configure the free fall, acceleration and environment sensors characteristics provided by a BlueNRG/BlueNRG-MS development platform configured as a BLE Sensor device, Peripheral role.

- The script is implemented using the new BlueNRG GUI language scripts based on the BLE ACI APIs. The BlueNRG GUI with script engine is delivered within BlueNRG GUI SW package.
- The script can also be run using the script launcher standalone utility available within BlueNRG GUI SW package.
- A PC running Windows Vista/7 operating systems (64 and 32 bit version) or Windows XP operating systems (32 bit edition), with available USB ports is required for installing the BlueNRG GUI SW package.

# SensorDemo_Central.py script, preliminary setup steps: configure a BLE platform as a BLE Sensor device, Peripheral role.

- BlueNRG/BlueNRG-MS platform configuration steps (valid only for STEVAL-IDB002V1,STEVAL-IDB005V1, STEVAL-IDB005V1D platforms):
  1. Open the IAR Embedded Workbench for ARM tool.
  2. Connect the selected platform to a PC USB port and to a STLink HW tool
  3. From the File->Open->Workspace menu, open the IAR workspace available on BlueNRG/BlueNRG-MS DK SW package: "Projects\Projects_STD_Library\SensorDemo\EWARM\SensorDemo.eww (BlueNRG), Projects\Projects_STD_Library\SensorDemo\EWARM_BlueNRG-MS\SensorDemo.eww (BlueNRG-MS)"
  4. Select desired configuration to build
  5. Select Project->Rebuild All. This will recompile and link the entire application
  6. To download the binary image on the selected development platform, please connect STLink to the platform JTAG connector
  7. Select Project->Download and Debug to download the related binary image
  8. Alternatively, open the BlueNRG GUI, put the board in DFU mode and download the built binary image
  9. NOTE: BlueNRG/BlueNRG-MS Sensor Demo, Peripheral role prebuilt binary image is also available on BlueNRG/BlueNRG-MS DK SW package: "Firmware\STM32L1_prebuilt_images\BlueNRG\BlueNRG_SensorDemo.hex, Firmware\STM32L1_prebuilt_images\BlueNRG-MS\BlueNRG-MS_SensorDemo.hex "
- BlueNRG-1 platform configuration steps (valid only for STEVAL-IDB007V1 platform):
  1. Connect the selected platform to a PC USB port
  2. Open the BlueNRG-1 Flasher tool avalable on STSW-BLUENRG1-DK SW package and download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG-1 DK x.x.x\Firmware\BLE_Examples\BLE_SensorDemo\BLE_SensorDemo.exe" file on the BlueNRG-1 platform

# SensorDemo_Central.py script execution steps through BlueNRG GUI Script Engine

- Open BlueNRG GUI
- BlueNRG/BlueNRG-MS platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Put selected platform in DFU mode and download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\STM32L1_prebuilt_images\BlueNRG_VCOM_x_x.hex" using the BlueNRG GUI, Tools, Flash Motherboard FW... utility
- BlueNRG-1 platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\BlueNRG1\DTM\DTM_UART_16MHz.hex or DTM_SPI.hex" file on the BlueNRG-1 platform using the BlueNRG Flasher utility available on BlueNRG-1 DK SW package (STSW-BLUENRG1-DK)
     - NOTES: SPI Network coprocessor configuration file (DTM_SPI.hex) requires some HW changes to be applied to the BlueNRG-1 development platform. Refer to STSW-BNRGUI user manual UM2058.
- On BlueNRG GUI, open the USB Port associated to the plugged platform
- On BlueNRG GUI, select the Scripts window
- On BlueNRG GUI, Scripts window, Scripts Engine section, click on ... tab and browse to the script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- BLE SensorDemo, Central device will look for the BLE advertising devices. Then it will connect to first discovered BLE Sensor Demo, Peripheral device and it will enable the related characteristic notifications
- BLE SensorDemo, Central device reads three times the temperature characteristic and it receives back the related values (EVT-BLUE_ATT_READ_RESP) from the BLE Sensor, Peripheral device (temperature value is printed on GUI "Sent/Received Packets" section)
- Once the acceleration characteristic notification is enabled from the BLE SensorDemo, Central device, the associated ACI_GATT_NOTIFICATION_EVENT events are received and the acceleration values on the threee axis (x,y,z) are displayed on GUI "Sent/Received Packets" section (further the free fall condition is detected)
- For terminating the script (and closing the current active BLE connection), click on "Terminate Script" tab

# Supported platforms

- BlueNRG-1 development platform (order code: STEVAL-IDB007V1)
- BlueNRG-MS development platform (order code: STEVAL-IDB005V1)
- BlueNRG-MS Daughter Board (order code: STEVAL-IDB005V1D)
- BlueNRG-MS USB dongle (order code: STEVAL-IDB006V1)
- BlueNRG development platform (order code: STEVAL-IDB002V1)
- BlueNRG USB dongle (order code: STEVAL-IDB003V1)

# Supported BLE devices and stack versions

- BlueNRG-1 stack v1.x
- BlueNRG-MS stack v7.2x
- BlueNRG stack v6.4x