STM32WB0 Bluetooth® LE PAwR/ESL features and applications


This wiki page provides general information about the Bluetooth® LE Periodic Advertising with Responses (PAwR) feature. It also presents the Bluetooth® LE Electronic Shelf Label (ESL) profile and associated STM32WB09 application examples, covering, respectively, the Electronic Shelf Label (ESL) and the Access Point (AP) roles.

1. Introduction

The legacy Bluetooth® LE advertising packets are sent during advertising events. These events are scheduled at specific intervals (advInterval) increased by a random value between 0 and 10 ms (advDelay). This helps avoid persistent collisions with other devices sending advertising packets.

Periodic advertising uses deterministic scheduling to allow a device to synchronize its scanning activity with the advertising activity of another device. A new synchronization mode is defined by the generic access profile, which allows the periodic advertising synchronization establishment procedure to be performed and synchronization with the advertising.

Periodic advertisements use a new Link Layer PDU called AUX_SYNC_IND. The required information (timing and timing offset) to synchronize with the periodic advertising packets is sent in a field called SyncInfo, which is included in the AUX_ADV_IND PDUs.

Periodic Advertising
Connectivity Periodic Advertising.png

The periodic advertising synchronization procedure consumes significant energy, and some devices fail to meet the requirements to execute this procedure.

A new procedure called Periodic Advertising Sync Transfer (PAST) has been defined to allow a device A, which receives periodic advertising packets from device B, to pass the acquired synchronization information to another device C, connected to the device A. As a result, the device C can receive the periodic advertising packets directly from device B without the need to scan for AUX_ADV_IND PDUs, which would consume excessive energy. Additionally, a device can send the synchronization information related to its own periodic advertising train through an ACL connection.

2. What is Periodic Advertising with Responses (PAwR)?

The Bluetooth® specification v5.4 introduces a new extension of the Periodic Advertising feature, called Periodic Advertising with Responses (PAwR). PAwR includes the following key features:

  • One-to-many topology from a broadcaster device to several observer devices.
  • Bidirectional communication, where the broadcaster can also receive data from individual observer devices.
  • Connectionless communication.
  • Scalability in a one-to-many topology capable of bidirectional application data communication.
  • Improved energy efficiency, as observers only listen for a short period at predefined intervals.
One-to-many topology
Connectivity One to Many.png

Periodic Advertising with Responses (PAwR) uses a connectionless communication framework, allowing data to be sent from one device (broadcaster) to one or more receiver devices (observers). The advertising packets are sent periodically at a fixed interval, and the observers can determine the periodic packet rate through the AUX_ADV_IND PDUs or by using the Periodic Advertising Sync Transfer (PAST) procedure.

PAwR observer devices can also send response packets back to the broadcaster, establishing a bidirectional, connectionless communication channel. This framework enables sending different data to each observer device or to a set of observer devices. The synchronization information for PAwR is included within the SyncInfo field and the ACAD field of AUX_ADV_IND PDUs.

The broadcaster can schedule transmissions within advertising events in a series of events and subevents. Observers are synchronized to listen during specific subevents only. Furthermore, the PAwR broadcaster can use a transmission time slot to send a connection request (AUX_ CONNECT_REQ) to a specific device and establish a connection with it.

PAwR advertising consists of PAwR events occurring at fixed intervals, called periodic advertising intervals. Each PAwR event is made up of subevents, during which packets are transmitted. The interval between two consecutive subevents is called a periodic advertising subevent interval.

PAwR event
Connectivity pawr event.png

At the beginning of a subevent, the broadcaster transmits one packet, and after a periodic advertising response slot delay, it can receive responses from observer devices inside the so-called response slots (one response packet in a single response slot). The interval between the start of two consecutive response slots is called the periodic advertising response slot spacing.

PAwR subevent
Connectivity pawr subevent.png

3. The Electronic Shelf Label (ESL) profile

Periodic Advertising with Responses is primarily used when application data is expected to change frequently and requires the Periodic Advertising Sync Transfer (PAST) procedure. The PAST procedure is optional for Periodic Advertising. This method is not suitable for application scenarios requiring real-time message exchange, as it provides a periodic transmission framework in specific time slots called subevents. The device listens only for specific subevents, resulting in inherent latency in this communication framework. The latency ranges from milliseconds to tens of seconds, depending on the network parameters.

A specific, standard Bluetooth® LE profile called Electronic Shelf Label (ESL) is defined. It is based on Periodic Advertising with Responses and connection-oriented communication. This profile provides a standard communication profile to manage and control electronic shelf labels, which are electronic devices placed on shelves in large stores.

The ESL device includes a display that uses an image to show information such as the name and price of the product on the shelf. It may also include LEDs to attract customers' attention and sensors to provide information such as the temperature or battery level. ESL device addresses consist of the following:

  • An 8-bit ESL ID
  • A 7-bit group ID

Each ESL device has a unique ID within a group of devices identified by a group ID. A specific device called the access point (AP) acts as a PAwR observer. The AP device configures the ESL through Generic Attribute (GATT) characteristic write operations performed on the established Bluetooth® LE ACL connection. It also writes the ESL ID and group ID. Response slot allocation is dynamically managed. ESL devices receive an array of one or more commands from the access point in PAwR AUX_SYNC_SUBEVENT_IND PDUs. All commands in a request packet are related to the same ESL group ID, but each command can be addressed to a specific ESL. The command index in the array defines the response slot to be used.

4. BLE_ESL/BLE_ESL_AP application examples

The STM32CubeWB0 MCU Package[1] provides two basic application examples:

  • The BLE_ESL application implements the ESL role of the standard ESL profile and acts as a PAwR observer device.
  • The BLE_ESL_AP application implements the Access Point role of the standard ESL profile and acts as a PAwR broadcaster device.

4.1. BLE_ESL application

Each ESL device is addressed by a Group ID (7-bit value) and an ESL ID (8-bit value). Addresses are assigned by the ESL Access Point (AP) through the provisioning procedure during the configuration phase of the node.

The ESL application starts as a simple advertising peripheral. Once an ESL AP device connects to the ESL peripheral, the ESL is provisioned with the information required to synchronize with the AP. This information consists of the ESL address, key materials, and absolute time. The ESL uses the PAST procedure to synchronize with the periodic advertising train and then disconnect the link. In particular, the device synchronizes only with the PAwR subevent corresponding to the group (for example, the ESL in group 0 synchronizes only with subevent 0). Once synchronized with the PAwR train, the ESL device can receive and execute ESL commands.

The following commands can be used for tests on ESL devices (these work only if CFG_LPM_SUPPORTED is set to 0):

  • ABSTIME: get the current absolute time.
  • SRVNEEDED: set the service-needed bit to true.
  • UNSYNC: set the ESL state to unsynchronized.

4.1.1. How to use the BLE_ESL application

Build and run steps:

  • Open the BLE_ESL project with the preferred toolchain.
  • Rebuild all files and load the image onto the STM32WB09 Nucleo board.
  • Open a serial terminal (with settings 921600-8-N-1 and <CR> transmission at the end of the line).
  • Reset the board to run the example.
  • Run BLE_ESL_AP on another STM32WB09 Nucleo board.

Once the BLE_ESL has been synchronized, AT commands can be sent from the BLE_ESL_AP application specifying a GROUP_ID and an ESL_ID.

As the Nucleo-WB09KE does not have a display, when a command to set an image is received, a message is printed on the terminal to notify the user about the received command.

4.2. BLE_ESL_AP application

This application demonstrates how to use an STM32WB09 device to communicate with ESL devices using the PAwR feature, and particularly the Access Point role of the ESL profile.

Commands are issued through the serial terminal to instruct the AP to add an ESL to the network. During the configuration phase, the AP assigns provisioning information, such as the ESL address, key materials, and time, by writing to specific characteristics. Then, the PAST procedure starts to allow the BLE_ESL application to synchronize with the PAwR train, without performing an energy-intensive scan. Once the procedure is complete, the link is automatically disconnected by the ESL.

ESL commands can be sent by the BLE_ESL_AP application through an AT-like command interface. Each command ends with <CR>. An "OK" or "ERROR" message is provided after a command is received. When a response is received from the peer, the terminal notifies this with a string in the format +<RESP>:<group_id>,<esl_id>,<status>[,<return_params>].

Commands can be broadcast to all ESLs in the group by specifying 0xFF as the ESL ID. In this case, however, the ESLs do not receive a response. Broadcast commands are retransmitted to improve reliability.

The number of groups equals the number of PAwR subevents, which can be configured using the PAWR_NUM_SUBEVENTS macro in app_conf.h (default value: 4). The value of <group_id> must be a number between 0 and (PAWR_NUM_SUBEVENTS - 1). Only <esl_id> can use the value FF for broadcast messages.

For each AT command that generates an ESL command, the corresponding packet is queued and sent as soon as possible with PAwR. If the ESL command is addressed to the connected ESL it is written to the ESL Control Point (ECP) characteristic of the device.

ATE can be typed to enable local echo.

The following AT commands can be used to send standard ESL commands:

  • AT+PING=<group_id>,<esl_id>: Ping
  • AT+UNASSOC=<group_id>,<esl_id>: Unassociate from AP
  • AT+SRVRST=<group_id>,<esl_id>: Service reset
  • AT+FRST=<group_id>,<esl_id>: Factory reset
  • AT+UPDCMP=<group_id>,<esl_id>: Update complete
  • AT+SENS=<group_id>,<esl_id>,<sensor_index>: Read sensor data
  • AT+REFRESH=<group_id>,<esl_id>,<display_index>: Refresh display
  • AT+IMG=<group_id>,<esl_id>,<display_index>,<image_index>: Display image
  • AT+IMGTIM=<group_id>,<esl_id>,<display_index>,<image_index>,<absolute_time>: Display timed image
  • AT+LED=<group_id>,<esl_id>,<led_index>,<led_component>,<pattern>,<off_period>,<on_period>,<repeat>: LED control
  • AT+LEDTIM=<group_id>,<esl_id>,<led_index>,<led_component>,<pattern>,<off_period>,<on_period>,<repeat>,<absolute_time>: LED timed control

Refer to the Electronic Shelf Label service specification for more details.

In addition to the previous list of AT commands, the following AT commands can be used to send proprietary ESL commands:

  • AT+TXT=<group_id>,<esl_id>,<text>: Set text; <text> can be a string with maximum 15 characters.
  • AT+PRICE=<group_id>,<esl_id>,<price>: Set price.

The following AT commands can be used to perform other special operations and tests:

  • AT+RECONF=<group_id>,<esl_id>,<new_group_id>,<new_esl_id>: Reconfigure an ESL with a new address
  • AT+CONN=<group_id>,<esl_id>: Connect to an ESL (ESL enters updating state)
  • AT+INFO: Read all information characteristics from the connected ESL
  • AT+DISPLAYINFO: Read the display information characteristic from the connected ESL
  • AT+SENSORINFO: Read the sensor information characteristic from the connected ESL
  • AT+LEDINFO: Read the LED information characteristic from the connected ESL
  • AT+CLRSCDB: Delete all bonding information
  • AT+ABSTIME?: Read current absolute time
  • AT+SCAN: Scan for ESLs
  • AT+PROVISION=<addr_type>,<address>,<group_id>,<esl_id>: Perform ESL device provisioning
  • AT+OTPSEARCH: Discover images on the connected server on the ESL
  • AT+OTPSEARCH=<name>: Search and select the specified image on the connected ESL
  • AT+OTPMETA: Read metadata for the current object
  • AT+OTPSTART=<truncate>: Open an L2CAP channel to transfer an image to the connected ESL. Set <truncate> to 1 to truncate image, otherwise set it to 0.
  • AT+OTPWRITE=<size>: Send the image data, up to the given size in bytes (maximum: 5000). The data to be sent is stored inside the obj.c file.
  • AT+OTPCLOSE: Close the L2CAP channel to transfer the image data. It should be issued when there are no other images to be sent.
  • AT+HELP: List of AT commands

4.2.1. How to use the BLE_ESL_AP application

Build and run steps:

  • Open the BLE_ESL_AP project with the preferred toolchain.
  • Rebuild all files and load the image onto the target memory.
  • Open a serial terminal with the following settings 115200-8-N-1 and <CR> transmission at the end of the line.
  • Reset the board to run the example.
  • Run the BLE_ESL application on another Nucleo board.
  • Launch ATE to enable echo.
  • Launch AT+SCAN to discover the ESL. The terminal should display: +SCAN: 0,0280E1AA0001.
  • Start ESL provisioning, for example with AT+PROVISION=0,0280e1aa0001,1,2, where 1 is the group ID and 2 is the ESL ID.
  • Once provisioning is complete, ESL disconnects. Commands can be sent on the terminal by specifying the assigned GROUP_ID and ESL_ID to:
    • Ping the board
    • Control an LED
    • Read sensor data
    • Set an image (only for testing purposes; images cannot be displayed on Nucleo boards)
  • Data can be sent with the Object Transfer profile to provide an image:
    • Connect to an associated ESL, such as AT+CONN=1,2.
    • Select an image to be written by providing an image name, for example, AT+OTPSEARCH=Image 1.
    • Open the channel to write the data with AT+OTPSTART=0.
    • Send data with AT+OTPWRITE=5000.
    • Close the channel with AT+OTPCLOSE.
    • Close the connection and put the ESL back to synchronized state with AT+UPDCMP, for example, AT+UPDCMP=1,2).

5. BLE_ESL/BLE_ESL_AP applications on STM32 Hotspot

On STM32 Hotspot[2], a dedicated STM32WB09 PAwR-ESL hotspot [3] application web page is available with the BLE_ESL_AP and BLE_ESL applications.

  • The BLE_ESL application can run on the following boards:
    • NUCLEO-WB09KE (available from the STM32WB09 PAwR-ESL Hotspot[3], in Firmware/Projects/NUCLEO-WB09KE/Applications/BLE/BLE_ESL).
    • STEVAL-ESL1KCB (available from the STM32WB09 PAwR-ESL Hotspot[3], in Firmware/Projects/STEVAL-ESL1KCB/Applications/BLE_ESL).
  • The BLE_ESL_AP application can run on the following board:
    • NUCLEO-WB09KE (available from the STM32WB09 PAwR-ESL Hotspot[4], in Firmware/Projects/NUCLEO-WB09KE/Applications/BLE_ESL_AP).

The STEVAL-ESL1KCB board is an example of a real ESL, with a 1.54-inch e-paper display and NFC tag.

STEVAL-ESL1KCB ESL kit
Connectivity ESL front blank.jpg

The STEVAL-ESL1KCB board contains the following key components:

  • STM32WB09KE ultralow-power programmable Bluetooth® LE SoC
  • 1.54-inch e-paper display.
  • ST25DV, a dynamic NFC/RFID tag IC with I2C interface.
  • NFC antenna (under the display).
  • LED.
  • Button for user interaction.
  • Reset button.
  • Battery holder for CR2032 batteries.

When the BLE_ESL firmware on the STEVAL-ESL1KCB board starts to run, the display is initialized by showing only a static background, without any text or price. In the top-right corner, a circle is used to show the current state of the ESL connectivity:

  • No circle: no Bluetooth® activity (no advertising/not synchronized with an AP).
  • Empty circle: ESL advertising, not synchronized.
  • Full circle: ESL synchronized with an AP.

By launching ESL commands from the BLE_ESL_AP application, it is possible to perform the following operations on the BLE_ESL application:

  • Set a text for a short description of the item (limited to 10 characters). Use the AT+TXT command in the BLE_ESL_AP application.
  • Set the price of the item (up to 999.99). Use the AT+PRICE command in the BLE_ESL_AP application.
  • Set a special icon, such as showing a discount. Use the AT+IMG command in the BLE_ESL_AP application.
  • Activate an LED. Use the AT+LED command in the BLE_ESL_AP application.

The NFC tag is used to program a URI that points to a website for more product info. The product can be identified by the ESL address (group ID and ESL ID).

The STEVAL-ESL1KCB kit supports the full set of AT commands, including sending text, image, and price. For example:

  • Turn on an LED on the ESL with address 0,0 (Group ID 0, ESL ID 0): AT+LED=0,0,1
  • Turn off the LED on the ESL with address 0,0: AT+LED=0,0,0
  • Read the battery level on the ESL 0,2: AT+BATT=0,2
  • Send a short text, such as "Peaches", to be displayed on the ESL 1,0 (available only on STEVAL-ESL1KCB): AT+TXT=1,0,Peaches
  • Set the price on the ESL 1,0 (available only on STEVAL-ESL1KCB): AT+TXT=1,0,4.95
  • Set an icon for a discount on ESL 2,0 (available only on STEVAL-ESL1KCB): AT+IMG=2,0,1
  • Turn on the LED on all the ESLs in group 2: AT+LED=2,ff,1
STEVAL-ESL1KCB price setting
Connectivity ESL price.jpg

Refer to the STM32WB09 PAwR-ESL Hotspot README file[5], for more information and the application execution flow.

Refer to the Bluetooth® LE stack v4.x programming guidelines (PM0274)[6], for more information about the PAwR feature.

6. Application performance

The PAwR train can be customized by changing several parameters. As described above, PAwR advertising consists of PAwR events occurring at fixed intervals, called periodic advertising intervals. Each PAwR event comprises subevents, during which packets are transmitted. The interval between two consecutive subevents is called the periodic advertising subevent interval.

At the beginning of a subevent, the broadcaster transmits one packet, and after a periodic advertising response slot delay it can receive responses from observer devices inside the so-called response slots (one response packet in a single response slot). The interval between the start of two consecutive response slots is called the periodic advertising response slot spacing. All parameters can be controlled on the Access Point through the following macros, which are defined in the app.conf.h file, available in the Projects\NUCLEO-WB09KE\Applications\BLE\BLE_ESL_AP\Core\Inc folder:

  • PAWR_NUM_SUBEVENTS: The number of subevents. It limits the number of supported groups because subevent #n is used to address only devices belonging to group ID #n. The maximum number of subevents supported by the Bluetooth® stack is equal to CFG_BLE_NUM_PAWR_SUBEVENTS.
  • PAWR_SUBEVENT_INTERVAL_MS: The interval (in milliseconds) between the start of two PAwR subevents.
  • PAWR_RESPONSE_SLOT_DELAY_MS: The interval between the start of the subevent and the first response slot.
  • PAWR_RESPONSE_SLOT_SPACING_US: The interval in microseconds between the beginning of two response slots. It must be long enough to let the observer send the response packet.
  • PAWR_NUM_RESPONSE_SLOTS: The number of response slots in the subevent.

The last four parameters must be chosen so that all response slots can fit inside a subevent: PAWR_SUBEVENT_INTERVAL_MS > PAWR_RESPONSE_SLOT_DELAY_MS + (PAWR_RESPONSE_SLOT_SPACING_US * PAWR_NUM_RESPONSE_SLOTS)/1000.

  • PAWR_INTERVAL_MS: The interval in milliseconds between the starts of two PAwR events. The default value is set to (PAWR_SUBEVENT_INTERVAL_MS * PAWR_NUM_SUBEVENTS + 200) to ensure the periodic advertising interval is long enough to accommodate all subevents, leaving a 200-ms interval at the end of the last subevent.

With the default values of the macros, that is, four subevents with a 100-ms subevent interval, the periodic advertising interval is set to 600 ms. This value has been chosen to provide a reasonable latency while keeping power consumption low. However, in real-world scenarios where ESLs must be powered on for years before the battery is replaced, this value may still be too aggressive. It is more common to have periodic intervals in the order of seconds, as there is no need for a short response time.

7. Changing the board firmware

If an STM32WB09 board was previously programmed with firmware using Deepstop mode, it may be not possible to use the SWD interface to program new firmware. In this case, the STM32WB09 device can be forced to enter bootloader mode and program new firmware:

  • On the STEVAL-ESL1KCB board, enter bootloader mode by pressing the reset button while keeping the user button pressed.
  • On the Nucleo-WB09KE board, press the reset button after placing a jumper in the bootloader mode position on JP1.

8. References