| Bluetooth Low Energy scripts

Simultaneous_Mode_Master_Slave.py File Reference

## Detailed Description

One BlueNRG-MS device (Master&Slave) is configured as Central & Peripheral, with a service and one characteristic and it performs two connections procedures (as Central) for connecting, respectively, to two BlueNRG-MS Peripheral devices (Slave_A, Slave_B) which have defined the same service and characteristic. Then BlueNRG-MS Master&Slave device enables the characteristics notification on both of them. At this stage, BlueNRG-MS Master&Slave device enters in discovery mode (acting as Peripheral) and it waits for connection request coming from another BlueNRG-MS device configured as Central (Master). Once this connection is performed, BlueNRG-MS Master&Slave device receives characteristics notifications from both BlueNRG-MS Slave_A, Slave_B devices and it notifies these characteristics (as Peripheral) to the BlueNRG-MS Master device which displays the related values.

- The script is implemented using the new BlueNRG GUI language scripts based on the BlueNRG-MS 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 GUISW package.

# Simultaneous_Mode_Master&Slave.py script, preliminary setup steps: configure two GAP Peripheral devices Slave_A, Slave_B using the Simultaneous_Mode_Slave.py script

- Open BlueNRG GUI available
- 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 Simultaneous_Mode_Slave.py script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- device Slave_A enters in discovery mode.
- Repeat same steps for configuring a Device Slave_B using the Simultaneous_Mode_Slave.py script

# Simultaneous_Mode_Master&Slave.py script execution steps through BlueNRG GUI Script Engine

- Open BlueNRG GUI available
- 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 Simultaneous_Mode_Master&Slave.py script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- Master&Slave device is configured as Central & Peripheral, with a service and one characteristic and it performs two connections procedures (as Central) for connecting, respectively, to two Peripheral devices (Slave_A, Slave_B)
- Then Master&Slave device enables the characteristics notification on both of Slave_A, Slave_B devices.
- Then Master&Slave device enables the characteristics notification on both of them. At this stage, Master&Slave device enters in discovery mode (acting as Peripheral) and it waits for connection request coming from another device configured as Central (Master).
- At this stage, Master&Slave device enters in discovery mode (acting as Peripheral) and it waits for connection request coming from another device configured as Central (Master) using the Simultaneous_Mode_Master.py
- Once this connection is performed, Master&Slave receives characteristics notifications from both Slave_A, Slave_B devices (as Central) and it notifies these characteristics (as Peripheral) to the Master device which displays the related values.

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

- Open BlueNRG GUI available
- 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 Simultaneous_Mode_Master.py script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- Master device is configured as Central and it performs a connection procedure for connecting to the Master&Slave device.
- Then Master device enables the characteristic notification on Master&Slave device.
- At this stage, Master receives and displays the received characteristics values with information sender identity (Slave_A or Slave_B).

# 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)

# Supported BLE devices and stack versions

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