This example demonstrates the implementation of a dynamic BLE Beacon that keeps changing its advertisement data based on either a Timer interrupt or a GPIO Button Press.
The project instantiates a BLE Broadcaster that advertises in Non-Connectable High Duty Cycle ADV mode. The device name is continuously updated in firmware to demonstrate dynamic advertisement payload update feature, every 10 seconds by means of a timer. In addition to this, the device name may be updated instantaneously by a GPIO Button press. The advertisement timeout is set to be infinite and the advertisement interval is set to 100 mS.
Tool: WICED Studio 4.0 and above, Any BLE Scanner (Example: LeHelloClient Mobile Application), Serial Terminal (Example: TeraTerm, CoolTerm)
Programming Language: C
Associated Parts: CYW20706
Related Hardware: BCM920706V2_EVAL Board
Figure 1: Block Diagram
Figure 2: Firmware Flow
The BTM_ENABLED_EVT indicated that the stack is turned ON. Upon the reception of this event, we start the Non Connectable High Duty Cycle advertisement. The Timer and GPIO Interrupts are registered. The Timer and GPIO Button Press Interrupt callbacks increment the suffix in the Device Name by 1 and then continues the advertisement with the incremented name.
Figure: 3
Figure: 4
8. You can notice that for every 10 seconds the name of the device gets incremented as ”DB App 1”, “DB App 2”, “DB App 3” and so on, by means of the timer interrupt in the firmware. This change in the device name can be noticed in the Scanner application by restarting the scanning.
9.The device name can also be incremented instantaneously by pressing the SW6 (BTN1) in the device.
Figure: 5
Table1 lists all relevant application notes, code examples, knowledge base articles, device datasheets, and Component / user module datasheets.
Table 1: Related Documents
Document | Title | Comment |
002-18191 | AN218191 - WICED™ Quick Start Guide for BT CYW20706 | The Quick Start Guide can be accessed from Project Explorer -> 20706-A2_Bluetooth -> Doc |
002-16535 | AN216535 - CYW92070xV3_EVAL Evaluation Board Hardware User Manual | The Hardware User Manual can be accessed from Project Explorer -> 20706-A2_Bluetooth -> Doc |