Connecting to a Peer BM70

 Objective

Using two BM-70-PICtail boards, this lab will have you explore GAP discovery and connection procedures on the BM70 module. Module 1 will act as the Advertiser while Module 2 will be the Scanner. In advertising mode, Module 1 will periodically transmit advertising information while Module 2 (the scanner device), will listen for advertising information transmitted by other devices.

Module 2 will also be the Initiator, which means it will be the module that initiates the connection by sending a connection request packet to Module 1. After the connection between both BM70 modules has been established, Module 1 becomes the Slave and Module 2 is therefore the Master.

You will:

  • Use the UI Configuration Tool to set up both modules to be used in Manual Pattern Mode
  • Dynamically trigger GAP Discovery and Connection modes/procedures via BM70 OP codes using the Manual Pattern Test Tool
    • Place Module 1 in Standby mode (Advertising)
    • Perform a scan from Module 2 (Scanning)
    • Connect from Module 2 to Module 1 (Connecting)

 Materials

Hardware Tools

Tool About Purchase
BM70-pictail-50px.png
BM-70-PICTAIL
BM70 Bluetooth Low Energy PICtail™ Plus

This lab uses a BM70 PICtail with version 1.06 of the firmware. If you don't have v1.06, go to the Firmware Upgrade page to update your BM70 module.

Software Tools

Be sure to install the MCP2200 USB drivers before starting. Also, download/extract the UI Configuration Tool as well as the Manual Pattern Test Tool to your PC using the links above.

Peer to Peer Connection Roles

The link layer roles defined for unicast (peer-peer) connections evolve as a function of the state of the connection as we see on the diagram below.

Roles.png

 Procedure

1

Connect both PICtails to your PC

Connect both PICtails to your PC and keep track of which Port Number was assigned to each.

COMPorts.png

After connecting the PICtails to your PC, place the modules in Test Mode by setting SW7 in the ON position, then press SW5 (Reset) to reset the modules. Also ensure the jumpers are all set as shown:

BM70Update.png

With Jumper JP8 shorted, LED1 will be lit (BLUE) indicating the module is in Test Mode, as shown above.

2

Launch the UI Configuration Tool

After extracting files from the User Interface (UI) Configuration Tool .zip file, double click on the application file called IS187x_102_BLEDK3_UI v100.132.exe to launch the utility.

NewUILoad.png

Load the default BM70 configuration file: IS1870SF_102_BLEDK3_UI v100.132(BM70) default.txt.

Select Edit and ensure that the BLEDK3 radio button is checked and that BM70 is the device selected under the Main Feature window. Then press OK.

BLEDK3withBM70.png

3

UI Configuration

We will start with Module 1 and after writing those settings to the module, we will launch the UI Configuration Tool again to configure Module 2.

a

Module 1 Settings

Below you will find the settings for the System Setup tab on the first module.

SettingsModule1.png

The settings above are the minimum settings we need to change in order to be able to complete this lab. If you would like to know why we disabled UART RX_IND, or if you want to know more about other settings in the Manual Pattern Tool, you can refer to the GAP Peripheral Demo (Making Connections) page. That page goes into more detail about the different configuration settings that change the behavior of a BLE Peripheral (e.g. Advertising Packets, Advertising Intervals, Scan Response, etc.). However, for the purposes of this lab, we will use their default values.

To be able to identify the module's state at any given time, I decided to also update the LED settings in the LED Setup tab.

Module1LEDSettings.png

As we can see under the Standby LED Flash Setting, LED1 on the BM70 PICtail will blink quickly 3 times every two seconds while the module is on Standby mode (Advertising). Once a connection has been established, the LED will remain turned on per the Link LED Flash Setting. Press Finish to enter the EEPROM parameters into the module.

Module1Write.png

To program these settings into the BM70 module, click on Write. Then, choose the correct COM port for Module 1 and press Write again. You will see a window asking if you are sure you want to write those settings to the EFLASH, click Yes. Lastly, click OK on the last pop-up window confirming the write has been successful.

b

Module 2 Settings

Open the UI Configuration Tool (if you closed it after configuring Module 1). Load and Edit the BM70 default configuration file as you did in Step 2. Below are the minimum settings required for Module 2.

Module2Settings.png

After you've made those changes, you are ready to program them into the BM70 module; click on Finish as shown above.

Module2Write.png

Click on Write, then choose the correct COM port for Module 2 and press Write again. You will see a window asking if you are sure you want to write those settings to the EFLASH, click Yes. Lastly, click OK on the last pop-up window confirming the write has been successful.

4

APP Mode

Move dip-switch SW7 to the OFF position (1) on both modules and reset them by pressing SW5 (button immediately above dip-switch).

Switch.png

5

Manual Pattern Tool

Open two different instances of the Manual Pattern Tool and connect to each one of your modules.

ConnectedModules.png

6

Module 1 Standby

On the Manual Pattern Tool connected to Module1, click on the GAP tab. Select Opcode 0x1C: Set Adv Enable and on the Standby Mode setting, select 0x01: Enter Standby Mode. Click on Send and Module 1 will start Advertising.

To gain a better understanding of the different Link Layer States on the BM70, it is recommended you visit the BM70 BLE Connection States page.

Module1Standby.png

If you changed the LED Setup settings in the UI Configuration Tool, you can take a look at your PICtail and you will see that the blue LED (P2_0/LED) will blink accordingly. In my case, it will blink three times every two seconds. Otherwise, it will blink once every 3 seconds (default setting).

LEDFlash.png

7

Module 2 Scan

On the Manual Pattern Tool for Module 2, click on the GAP tab. Select the 0x16: Set Scan Enable Opcode. Then, select the command to start scanning which is 0x01: Scanning Enabled. On the Filter Duplicate box, select 0x01: Duplicate Filtering Enabled; this will ensure that we only see one instance of Module 1 on our Advertising List. Press Send.

Module2Scan.png

After a few seconds, you will see a list of various devices found nearby like the one below.

ScanResults.png

You will have to look through this list to find the name you gave your module. I have circled our Module1 in red above.

8

Module 2 Connect

On the Manual Pattern Tool for Module 2, go to the GAP tab. Select Opcode 0x17: LE Create Connection, go down to the list of devices that were found during the scan and select Module1. Doing this will automatically fill in the Peer Address field with the MAC address of the module we are trying to connect to. Lastly, issue the command by pressing Send.

Module2Connect.png

The Device Address we see above is a fundamental identifier, similar to an Ethernet MAC address. There are two types available:

  • Public device address
    • Equivalent to the IEEE-assigned MAC address that never changes.
  • Random device address
    • Dynamically generated at run time.

You can look at the BM70 PICtail and LED1 should be lit up indicating a Connected status. If you did not change the LED Setup settings on the UI Configuration Tool, blue LED (P2_0/LED) will blink twice every 1.5 seconds (default setting)

LinkLED.png

 Conclusions

In this lab you were able to explore the different Opcodes needed to advertise, scan, and connect with a BM70 module.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.