STM32WB Bluetooth® LE Additional Advertising

Revision as of 17:37, 7 March 2022 by Registered User

1 STM32WB - additional advertising

This section gives a description on how to use Additional advertising feature available with STM32CubeWB MCU Package [1]

Additional advertising (beacon ) may broadcast:

  • An identifying code that allows apps to retrieve information from app servers. These can be used for indoor location, identification of physical objects, and to interact with apps. It is up to the developer to decide.
  • A URL of at most 18 characters that redirects to a website that is secured using SSL. This beacon is the underpinning of the Physical Web.

It is a solution to get additional advertising set on top of the standard advertising including:

  • one additional advertising: undirected non connectable
  • random address (or public address if not currently used by the standard advertising)
  • handled at GAP level
  • dedicated Tx power level for the beacon advertising
  • no whitelist and privacy unused
Additional advertising - what for?
Connectivity Add Beacon3.png

2 Technical description

The additional adversting is managed at GAP level thanks to three commands:

  • ACI_GAP_ADDITIONAL_BEACON_START
Parameters Description
Adv_Interval_Min Minimum advertising interval. Time = N * 0.625 ms
Adv_Interval_Max Maximum advertising interval. Time = N * 0.625 ms
Adv_Channel_Map Advertising channel map. Default: 00000111b (all channels enabled).
Own_Address_Type Own address type: public or static random.
Own_Address Public Device Address or Random Device Address.
PA_Level Power amplifier output level. Output power is indicative and depends on the PCB layout and associated components.


  • ACI_GAP_ADDITIONAL_BEACON_SET_DATA
Header text Header text
Adv_Data_Length Length of Adv_Data in octets
Adv_Data Advertising data used by the device while advertising.


  • ACI_GAP_ADDITIONAL_BEACON_STOP

For more information refer to STM32WB Bluetooth® Low Energy (BLE) wireless interface application note

2.1 Standard advertising first, additional beacon second

This is an example on how to implement both sets of advertising with standard advertising first

  • A1 = standard advertising Interval: Minimum = 125 ms maximum = 125 ms
  • A2 = additional advertising interval: minimum = 240 ms maximum = 256 ms
Standard Adverting first

:

2.2 Additional beacon first, standard advertising second

This is an example on how to implement both sets of advertising with additional advertising first.

  • A1 = additional advertising Interval: minimum = 62.5 ms maximum = 62.5 ms
  • A2 = standard advertising Interval: minimum = 240 ms maximum = 256 ms
Additional Advertising First

The minimum interval to support both advertising sets is 30 ms


3 STM32WB - P2P server application and additional advertising implementation

Based on the official P2P server application, below is a description on how to implement an additional beacon with the following characteristics:

  • advertising interval between 30 ms and 40 ms
  • advertising data element contains Eddystone-URL: www.st.com

Since the requested advertising interval is less than the advertising Interval of P2P application (80/100 ms), it is recommended first to initiate the additional non-connectable advertising.

#define CFG_ADD_ADV_INTERVAL_MIN          (0x30)   /**< 30ms */
#define CFG_ADD_ADV_INTERVAL_MAX          (0x40)  /**< 40ms */
 tBleStatus ret = BLE_STATUS_INVALID_PARAMS;

**
 * Advertising Data Additional Beacon - Eddystone URL
 */
uint8_t add_beacon_data[17] =
  {
    16 ,                                                /*< Length. */
    AD_TYPE_SERVICE_DATA,                               /*< Service Data data type value. */
    0xAA, 0xFE,                                         /*< 16-bit Eddystone UUID. */
    0x10,                                               /*< URL frame type. */
    0x00,                                               /*< Tx Power - Ranging data. */
    0x02,                                               /*< URL Scheme Prefix is http://www. */
    0x77,0x77,0x77,0x2E,0x73,0x74,0x2E,0x63,0x6F,0x6D,  /*< www.st.com */
   };

ret = aci_gap_additional_beacon_start (
        CFG_ADD_ADV_INTERVAL_MIN,
        CFG_ADD_ADV_INTERVAL_MAX,
        0x07,
        CFG_BLE_ADDRESS_TYPE,
        bd_addr,
        CFG_TX_POWER);
    if (ret == BLE_STATUS_SUCCESS)
    {
      APP_DBG_MSG("CMD ==> Successfull ACI_GAP_ADDITIONNAL_BEACON_START\n" );
    }
    else
    {
       APP_DBG_MSG("CMD ==> Failed ACI_GAP_ADDITIONNAL_BEACON_START , result: %d \n", ret);
    }
        
    ret = aci_gap_additional_beacon_set_data(
          sizeof(add_beacon_data),
          (uint8_t*) add_beacon_data);
    if (ret == BLE_STATUS_SUCCESS)
    {
       APP_DBG_MSG("CMD ==> Successfully ACI_GAP_ADDITIONNAL_BEACON_SET_DATA \n" );
    }
    else
    {
       APP_DBG_MSG("CMD ==> Failed ACI_GAP_ADDITIONNAL_BEACON_SET_DATA, result: %d \n", ret);
    }
Hyperterminal Trace
Connectivity Add Beacon4.png


The "www.st.com" additional beacon packets (non-connectable) are sent between the advertising packets of the P2P server application.

P2P Server & Beacon Advertising Packets - Ellisys trace

When a connection is established by a remote device, the beaconing is still active. It can be stopped only by sending ACI_GAP_ADDITIONAL_BEACON_STOP

Beacon advertising packets with P2P server connection- Ellisys trace

4 References