Start with STM32 and Bluetooth® Low Energy |
Learn how to set up STM32 for Cellular connectivity applications |
Start with STM32 and LoRaWAN |
Start with STM32 and Matter connectivity applications |
Learn how to set up STM32 for Thread connectivity applications |
Learn how to set up STM32 for Wifi connectivity applications |
Learn how to set up STM32 for Zigbee connectivity applications |
Start with STM32 and 802.15.4 applications |
1. How to enable Antenna diversity on STM32WBA
1.1. Introduction
Antenna diversity is a technique used to improve wireless communication between devices in a noisy environment where multipath propagation[1] is a recurring issue.
The purpose of antenna diversity is to provide a seamless way to switch between several antennas during a device runtime without any overhead for the user on the application side. The best antenna is selected based on specified metrics.
This document aims at presenting the antenna diversity feature present on STM32WBA “BlueFish”, both WBA5xx and WBA6xx and how it can be added in any 802.15.4 application.
[1] https://en.wikipedia.org/wiki/Multipath_propagation
1.2. Antenna diversity presentation
1.2.1. Use-case
Antenna diversity shows its advantage when the device is communicating with only one device; comparison between antennas should only be done with packets received/sent from the same device. As such it is advised but not mandatory to enable antenna diversity on End Device (Open Thread) or Node (MAC) when it established an association with the Leader/Coordinator.
1.2.2. Antenna selection metrics
The selection of the best antenna is based on several criteria, from high to low:
- Error status
- RSSI during frame reception above the RSSI threshold
- Best RSSI from both antennas
The feature is best suited for endpoint devices (i.e. most communication will be done with one device after association is done) as comparing RSSI and error status using several antennas should always be done with packets received from the same source. The antenna diversity device can still communicate with other devices; however, it will be using the best antenna selected during communication with the Leader/Coordinator. Meaning the antenna selected during the runtime of the device could result in worse performance when communicating with several devices, hence the recommendation to only use on endpoints devices.
RSSI threshold is configurable by the user (see Enabling Antenna diversity on your application).
1.2.3. Interval measure
The selection of the best antenna is periodically done, during what is called antenna diversity interval measure (shortened to interval measure afterwards).
ST provides two possible configurations for the interval measure:
- Periodic in time.
- Periodic in number of radio activities.
Radio activities consists in the following:
- Any of TX/RF from/to the coordinator
- ACK following one of the above
Note: a TX/RX with ACK request count as two radio activities.
1.2.4. Antenna switch signal
At the time of writing there is no official WBA version supporting dual antennas. Instead, the switch between antenna is driven by a logical signal. When this signal is low, the 1st antenna is assumed to be used. When it is high, the 2nd antenna.
This signal is output on PA12 (corresponding to CN4-17 on MB18011- Nucleo). For latency reason this signal is HW-driven and as such it is not currently possible to change the GPIO.
A module board is required alongside the WBA to control the switch between two antennas. Refer to section Antenna switch board showcase: MB2096A for more information.
1.2.5. Antenna switch algorithm (RSSI only)
- If current Antenna RSSI is always above defined threshold, no attempt to test the second one.
- If both antennas return an RSSI below the threshold, they will be tested every measure interval to pick the best one (best-effort case).
- Interval measure recommendations:
- Set the interval measure occurrence long enough to test all antennas.
- If low power enabled on device, uses the radio activities configuration to avoid sporadic wakeup of the radio.
1.2.6. Antenna selection considering error code
Packet errors include FCS error, No-Ack reception error, Generic filtration error. An antenna giving worse RSSI is always privileged to an antenna giving error code.
Best RSSI | Status ANT1 | Status ANT2 | Best antenna |
ANT1 | None | None | ANT1 |
1.3. Antenna switch board showcase: MB2096A
The MB2096A is a proof-of-concept board used to test features using several antennas, such as AoA & AoD in BLE, or antenna diversity in 15.4. The working is simple, one SMA I/O called RFC with 8 possible SMA I/O RF1 to RF8. 3 bits controls pin are added to select the desired RFx path.
The user can select whichever set of antennas he desires based using the truth table.