STM32WBA Bluetooth® LE – Long Range

Revision as of 14:49, 2 April 2024 by Registered User (→‎Principles)


1. STM32WBA Long Range

Long range or LE coded feature is a way to extend BLE range up to 1,6 km or more.

Using advertising extension feature is the way to activate LE coded advertising Primary (and secondary) PHY as LE coded.

New parameters values are defined in HCI and ACI commands.
Based on BLE_p2pClient_Ext and BLE_p2pServer_Ext applications, two new applications have been developed to demonstrate the feature and to provide range measurements: BLE_App_Long_Range_Central and BLE_App_Long_Range_Peripheral.

Applications functionalities are derived from BLE_p2pClient and BLE_p2pServer applications:
Refer to the following page for Peer to Peer project explanation.

1.1. Principles

Advertising extension feature is necessary.
Modified or new GAP commands have been implemented to enable LE coded feature.


  • To set advertising parameters:

aci_gap_adv_set_configuration: Adv_Mode parameter: 0x02: use LE coded as primary advertising PHY.

  • Scan procedure:

aci_gap_ext_start_scan: scanning_PHY parameter: 0x04: use of LE coded as scan PHY.

  • Connection:

aci_gap_ext_create_connection: initiating PHYs parameter: 0x04: use of LE coded as scan connectable PHY.

aci_gap_adv_set_configuration

Description

This command is used to set the extended advertising configuration for one advertising set.
Syntax
tBleStatus aci_gap_adv_set_configuration( uint16_t Connection_handle, uint16_t SPSM, uint16_t MTU, uint16_t MPS, uint16_t Initial_credits, uint8_t Channel_number );
Parameters
[in] Adv_mode
Type: uint8_t
Description: Bitmap of extended advertising modes.
'[in] Advertising_handle
Type: uint8_t
Description: Used to identify an advertising set.
[in] Adv_Event_Properties
Type: uint16_t
Description: Type of advertising event.
[in] Primary_adv_interval_min
Type: uint32_t
Description: Minimum advertising interval.
[in] Primary_adv_interval_max
Type: uint32_t
Description: Maximum advertising interval.
[in] Primary_adv_channel_map
Type: uint8_t
Description: Advertising channel map.
[in] Own_address_type
Type: uint8_t
Description: Own address type: if Privacy is disabled, the address can be public or static random; otherwise, it can be a resolvable private address or a non-resolvable private address.
[in] Peer_address_type
Type: uint8_t
Description: Address type of the peer device.
[in] Peer_address
Type: 6 bytes
Description: Public Device Address, Random Device Address, Public Identity Address, or Random (static) Identity Address of the device to be connected.
[in] Adv_filter_policy
Type: uint8_t
Description: Advertising filter policy.
[in] Adv_Tx_power
Type: uint8_t
Description: Advertising TX power. Units: dBm.
[in] Secondary_Adv_Max_Skip
Type: uint8_t
Description: Secondary advertising maximum skip.
[in] Secondary_Adv_PHY
Type: uint8_t
Description: Secondary advertising PHY.
[in] Adv_SID
Type: uint8_t
Description: Value of the Advertising SID subfield in the ADI field of the PDU.
[in] Scan_Req_Notification_Enable
Type: uint8_t
Description: Scan request notifications.
Return value
[out] command status
Type: uint8_t

1.2. Advertising data

At startup, Peer To Peer Server application starts Advertising.
Data advertised are composed as follows:

P2P Server Long Range Advertising packet
Description Length AD Type Value
Device Name 8 0x09 p2pS_LR_XX (XX: last byte of BD address)
Manufacturer Data 15 0xFF See table below
Flags 2 0x01 0x06
(GeneralDiscoverable, BrEdrNotSupported)



Manufacturer data are encoded following STMicroelectronics BlueST SDK v2 as described below:

STMicroelectronics Manufacturer Advertising data
Byte Index 0 1 2-3 4 5 6 7 8 9 10-15
Function Length Manufacturer ID Company BlueST SDK Version Device ID Firmware ID Option 1 Option 2 Option 3 Device Address
Value 0x0F 0xFF 0x0030 STMicro 0x02 0x8B Nucleo-WBA 0x8F - p2p Server Long Range 0x00 0x00 0x00 0x08E12Axxxx


1.3. STM32WBA Long Range Central and Peripheral application

Long Range Central acts as a Central device with the support of GATT Client Layer.
At startup, by pressing B1 button, Long Range Client application:

  • Starts scanning to detect Long Range Server application by filtering the Firmware ID of the STMicroelectronics Manufacturer advertising data
  • Stops Scanning once Long Range server detected
  • Connects to the Long Range Server to establish the connection.
  • Discovers GATT Service & Characteristics of the Long Range server
  • Enable all GATT server notification characteristics

Once connected, the Long Range Client application:

  • By pressing B1 button, write a message to toggle the Blue LED of the Long Range Server
  • Receive notification to toggle the on board Blue LED from remote Long Range Server Application.

Long Range Peripheral acts as a Peripheral device with the support of GATT Client Layer.
At reset, Long Range Peripheral application starts one extended advertising set at primary and secondary LE coded PHY.

Once connected, on both applications:

  • By pressing B2 button, HCI_LE_SET_PHY command is sent. It allows to toggle Phy_options parameter S=8/2 (red led is ON/OFF)
Info white.png Information
Change in PHY Coded option is not notified to remote device.


Example of flow diagram between STM32WBA Long Range Server & Long Range Client
STM32WBA P2P Flow Diagram


B2 to toggle Phy options S=2, S=8
STM32WBA P2P Flow Diagram


1.4. On-board buttons configuration

Button configuration for Bluetooth® Low Energy Long Range application on Nucleo-WBA52CG boards
Application Condition B1 Click B1 Long Press B2 Click B2 Long Press B3 Click B3 Long Press
Long Range Server Idle

Connected

-

Starts/Stops notification

/ -

Change LE coded PHY Options

/ -

-

/
Long Range Client Idle

Connected

Starts scan then connects

Starts/Stops write data

/ -

Change LE coded PHY Options

/ -

-

/


1.5. Collector applications compatibility

The BLE_App_Long_Range_Peripheral project is compatible with the following collector:
BLE_App_Long_Range_Central or a smartphone Which supports LE coded feature.

1.6. Code example

A STM32WBA Long Range code example has been shared on STM32-Hotspot GitHub [1]

2. References

No categories assignedEdit