Connecting to a Peer BM70

Last modified by Microchip on 2023/11/10 11:11

Objective

Using two BM-70-PICtail boards, this lab will have you explore Generic Access Profile (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 User Interface (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)

Back to Top

Reference Materials

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

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

Back to Top

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 in the diagram below.

Link layer roles defined for unicast (peer-peer) connections

Back to Top

Procedure

Connect Both PICtail Boards to Your PC

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

Device Manager Port Numbers assigned

After connecting the PICtail boards 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:

Module in Test mode

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


Launch the UI Configuration Tool

After extracting files from the v100.132.zip UI Configuration Tool ZIP file, double click on the IS187x_102_BLEDK3_UI v100.132.exe application file to launch the utility.

Load txt file into UI Configuration Tool

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

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

Select Edit and then OK in Configuration Tool


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.

Module 1 Settings

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

System Setup tab on the first module

The settings above are the minimum settings we need to change 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 Bluetooth® Low Energy (BLE) Peripheral (e.g., Advertising Packets, Advertising Intervals, Scan Response, etc.). However, for this lab, we will use their default values.

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

update the LED settings in the LED Setup tab

As we can see under the Standby LED Flash Setting, LED1 on the BM70 PICtail will blink quickly three times every two seconds while the module is in 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.

Click on Write. Choose the correct COM port for Module 1 and press Write again. Select Yes to write to EFLASH then select OK

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.

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.

Minimum settings required for Module 2

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

Click on Finish then Click on Write.  Choose the correct COM port for Module 2 and press Write again. To write those settings to the EFLASH, click Yes then select OK

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.


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

SW7 to the OFF position on both modules and reset them by pressing SW5


Manual Pattern Tool

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

Manual Pattern Tool instances.  Select Connect on both instances.


Module 1 Standby

On the Manual Pattern Tool connected to Module 1, click on the GAP tab. Select 0x1C: Set Adv Enable for Opcode and 0x01: Enter Standby Mode for 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, we recommend you visit the "BM70 BLE Connection States" page.

Manual Pattern Tool connected to Module1

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 this case, it will blink three times every two seconds. Otherwise, it will blink once every three seconds (default setting).

Module LED Flashing


Module 2 Scan

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

Manual Pattern Tool for Module 2, click on the GAP tab.

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

Advertising list of nearby devices

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


Module 2 Connect

On the Manual Pattern Tool for Module 2, go to the GAP tab. Select 0x17: LE Create Connection for Opcode. 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.

Manual Pattern Tool for Module 2 GAP tab.

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)

LED Flash setting

Back to Top

Conclusions

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

Back to Top