BM71 GAP Peripheral Demo (Making Connections)

 Objective

This lab exercise will have you configure, then explore, Generic Access Profile (GAP) discovery and connection procedures on a BM71 configured as a GAP Peripheral, using a BM-71 PICtail™ board.

You will:

  • Configure key static module configuration settings using the User Interface (UI) Configuration Tool (Device Name, Pinout, Operation mode, Default ADV & SCAN_RSP packet payload data and interval, LED0 etc…)
  • Dynamically trigger GAP Discovery modes and procedures via BM71 OP codes using the Manual Pattern Test Tool
  • Interact with the board using a smartphone app

 Materials

Hardware Tools

  • BM71 PICtail
  • Android Smartphone (Lab tested with BLU Advance 5.0).
    • OS version 4.4 or higher
    • BT 4.0 or higher hardware
  • Apple Smartphone
    • OS version 5 or later
    • BT 4.0 or higher hardware

This lab uses a BM71 PICtail with version 1.06 of the firmware. If you don't have v1.06 (or, are unsure which version you do have), go to the "BM71 Firmware Upgrade" page to update your BM71 module.

Software Tools

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

 Connection Diagram

lab2-connection-diagram.png

Manual Pattern Flow Chart

For this example, the BM71 is configured to operate in Manual Pattern mode (i.e., a Generic Bluetooth® Low Energy (BLE) Link Controller). The following flow chart depicts the operation:

ManualPatternFlowChart.png

 Procedure

Peripheral Configuration

1

Place the Module in Test Mode

After connecting the PICtail to your PC using the supplied USB cable, place the module in Test mode by setting SW7 in the ON position, then press SW5 (Reset) to reset the module. Also, ensure the jumpers are all set as shown:

BM70Update.png

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

2

Launch the UI Configuration Tool

Open the BLEDK3 UI Configuration Tool and load the default BM71 configuration file: IS1871SF_102_BLEDK3_UI v100.132(BM71) default.txt

new-ui-load.png

"Default" BM71 configuration files are located in the root folder where the UI Config Tool is installed.

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

bledk3-with-bm71.png

System Setup Tab

3

Change Device Name

In the Device Information pane, set the Name Fragment to lab2p-XXXX where XXXX is the last four digits of the BM71 MAC address. This identifier will become the GAP Service Device Name characteristic, as well as the Local Name identifier during advertising.

lab2-step3.png

This lab exercise was developed for a classroom environment having many radios. Appending the last four digits of the MAC address to the Device Name aids in identifying a specific board during the general discovery process.

The device name should be unique. Also, since the advertising packet is pretty small (31-byte max. payload), we suggest you limit the name ID to fewer than eight characters (i.e., for the 10-character device name shown, if you try to add a 16-byte private service to the ADV payload, you will get an error message).

4

Disable UART_RX_IND

Scroll down to the Uart Setting pane, then select to Disable from the UART RX_IND pull-down as shown.

DisableUARTRXIND2.png

When enabled, this feature places the module into a Lower Power Operating mode, shutting off its UART RX operation. The host MCU needs to drive this pin low for at least 3 ms before sending the next packet to the module, as shown.

uart-rx-ind-pin-timing-diagram.png

5

Configure Manual Pattern (BLE GATT) Operation Mode

In the Operation Mode Setting pane, select Manual Pattern for Operation Pattern as shown.

ManualPattern.png

Click OK on the pop-up dialog box that follows.

FlowControl.png

Click Next to proceed to the next tab.

System Setup2 Tab

6

General Purpose Input/Output (GPIO) Configuration

In the GPIO Configuration pane, ensure the GPIO pin radio button settings are left at default settings as shown below.

ui-config-tool-system-setup2.png

Click Next to proceed to the next tab.

LE Mode Setup Tab

7

ADV Packet Interval

In the LE Advertising Setting pane, set the ADV packet interval, referred to here as LE Fast Advertising Interval, to 100 ms by writing "0x00A0" in the field as shown below.

FastAdvertising.png

LE Fast Advertising Timeout and LE Reduced Power Interval/Timeout parameters are only used for Auto-Pattern mode operation.

Leave the remaining parameters as-is.

8

ADV Packet Payload

In the Advertising Data Setting pane, ensure that Complete Device Name and Flag are checked and included in the payload. (The GAP Device Name characteristic will automatically be included in the ADV packet as the Local Name.)

lab2-step8.png

This tab sets the default (static) ADV_IND type advertising packet payload, which is issued when the BM71 is operating in GAP General Discoverable mode. ADV types and parameters may be changed dynamically via op-code 0x13 (Set_Advertising_Parameter).

9

SCAN_RSP Packet Payload

In the Scan Response Data Setting pane, ensure that Tx Power is enabled for the payload.

lab2-step9.png

A SCAN_RSP packet is returned to a Scanner who has issued a SCAN_REQ packet. These packets provide additional information to a Scanner/Central device.

The remainder of the settings are left at their defaults.

10

Write Settings

Press Finish.

Write.png

To program these settings into the BM71 module, click on Write, select the COM port you are using and press Write again.

WriteSettings2.png

On the window that pops up, click Yes and lastly, OK as shown above.

Close the UI Configuration Tool.

GAP Discovery and Connection

Discovery means:

  • Put the Peripheral in General Discoverable mode (start Advertising).
  • Trigger the Central to initiate the General Discovery Procedure (Scanning).

Connection means:

  • Central runs a general Connection Establishment Procedure (scan/select a peripheral based on certain criteria, then initiate a direct connection establishment procedure).

11

Place the Module in Application Mode

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

Switch.png

12

Launch the Manual Pattern Test Tool

Open the Manual Pattern Test Tool, and connect to the COM port associated with the board.

ManualConnection.png

13

Command and Response

Verify the connection by sending a Read Local Information packet. Select 0x01: Read Local Information for Opcode in the Common tab.

ReadLocalInfo.png

If COM port connection was successful, you will see results similar to the following Log View and Local Information panes:

lab2-step13.png

Log View does not display packet delimiter (0xAA) or checksum values on out-going or in-coming packets.

CommandPacket.png
Analysis of the “Read Local Information” (0x01) Command Packet
ResponsePacket.png
Analysis of the “Read Local Information” (0x01) Event Packet

14

Mode of Operation

Verify the BM71 state/mode of operation by sending a Read BLEDK3 Status packet. Select 0x03: Read BLEDK3 Status for Opcode in the Common tab.

ReadStatus.png

The module should be on Idle mode.

IdleMode.png

Advertising Overview (BM71)

15

Set Advertising Data

On BM71, the ADV interval, as well as ADV_IND and SCAN_RSP payload data can be set statically (using the UI Configuration Tool) and dynamically (via command op-codes/packets).

Since we’ve set an appropriate ADV_IND Interval, as well as ADV_IND and SCAN_RSP payload data using the UI Configuration Tool (steps 7 thru 9 above), we will not need to update them dynamically via the Manual Pattern evaluation tool below.

If you need to update ADV and SCAN_RSP payload data dynamically, select the ADV / SR Data tab and set advertising and scan response data payload. Then, pressing Update will issue GAP Command Opcode 0x11 (Write_Adv_Data) to update the payload data sent during Advertising (Standby) mode:

UpdateCommand.png

If you need to update ADV Interval dynamically, GAP op-code 0x13 (Set_Adv_Parameter) may be used to dynamically alter the ADV interval:

UpdateDynamically.png

On a BM71 Reset, the ADV interval, as well as ADV_IND and SCAN_RSP payload data will revert back to those settings made in the UI Configuration Tool, and saved to non-volatile configuration memory. Any dynamic changes (made via command op-codes/packets) will be lost.

Put the BM71 Peripheral in General Discoverable Mode

16

Begin Advertising

All GAP operations are controlled via the GAP tab

In the GAP tab, select 0x1C: (Set Adv Enable) for Opcode. Select 0x01: (Enter Standby Mode) for Standby mode. Finally, press Send as shown:

EnterStandby.png

You should see the following indicators of success:

BT Status will show "0x03: Standby Mode"

StandbyMode.png

Blue LED (P2_0/LED) will blink once every three seconds (default setting - configurable via UI Config Tool):

LEDFlash.png

You should also see the peripheral’s Local Name displayed in the Smart Discover App, along with RSSI and ADV Interval (Android):

SmartDiscover.png

17

Connect to the BM71 Peripheral Using SmartDiscover App

In the scan list, select the BM71 device you wish to connect to by tapping on it.

You will see the following indicators of success:

BT Status will show "0x0C: BLE Connected Mode" and LE Connection Information (provided by the Central) is also provided.

ConnectedMode.png

Blue LED (P2_0/LED) will blink twice every 1.5 seconds (default setting -configurable via UI Config Tool):

LEDFlash.png

In SmartDiscover, the default services will have been enumerated, and the ADV and SCAN_RSP data displayed for the device:

SmartDiscover2.png

18

Disconnect from the BM71 Peripheral Using SmartDiscover App

In the SmartDiscover app, disconnect from the device by tapping DISCONNECT.

You should see the following indicators of success:

BT Status will show "0x09 Idle Mode":

Disconnect.png

Blue LED (P2_0/LED) will stop blinking:

LEDFlash.png

 Conclusions

A GAP Peripheral device needs to set up:

  • ADV payload data
  • SCAN_RSP payload data
  • Advertising interval
  • BM71 parameters may be modified statically or dynamically:
    • Statically: Using the UI Configuration Tool, or via Direct-write to configuration non-volatile memory.
    • Dynamically: Via op-codes/packets send to the module
© 2020 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.