External Coexistence Design en

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

External Coexistence Design

(Application Note)

Related Products
All ESP chip series, except ESP8266 and ESP32 series

Version 1.1
Espressif Systems
Copyright © 2022

www.espressif.com
About This Document
This document provides information about 1-wire, 2-wire, and 3-wire Wi-Fi coexistence
schemes for Espressif customers when configuring devices equipped with ESP Wi-Fi
SoCs (including all ESP chip series except ESP8266 and ESP32 series).

Release notes

Date Version Release Notes

Aug 2022 V1.1 Fixed a typo.


Updated the document title.

Jan 2022 V1.0 Initial release.

Documentation Change Notification


Espressif provides email notifications to keep customers updated on changes to
technical documentation. Please subscribe at https://www.espressif.com/en/subscribe.

Certification
Download certificates for Espressif products from
https://www.espressif.com/en/certificates.
Table of Contents
1. Introduction ................................................................................................................................... 1
2. Architecture Design ...................................................................................................................... 2
2.1. Mapping of Coexistence Modes and PTA (Packet Traffic Arbitration) Signals ..................... 2
2.1.1. 1-wire mode ........................................................................................................... 2
2.1.2. 2-wire mode ........................................................................................................... 3
2.1.3. 3-wire mode ........................................................................................................... 3
2.1.4. Coexistence Signaling Timing Information .............................................................. 4
2.2. Coexistence PTA (Packet Traffic Arbitration) Flow .............................................................. 5
2.3. Wi-Fi Key Packets ............................................................................................................... 6
3. Design Implementation................................................................................................................. 7
3.1. Software interfaces in ESP-IDF............................................................................................ 7
4. Q&A .............................................................................................................................................. 9
Appendix A. Terminology ........................................................................................................ 10
Chapter 1. Introduction

1. Introduction
In the 2.4 GHz ISM band, the availability of channels is regulated per country. There are
mainly three communication protocols worldwide: Bluetooth® (BLE & BT), 15.4
(Zigbee & Thread), and Wi-Fi.

Figure 1-1. 2.4 GHz Channel Map

Nowadays, more and more Espressif’s Wi-Fi SoCs share the 2.4 GHz frequency band
with other devices, such as BLE, BT, and Zigbee. In this case, Espressif implemented a
hardware interface and protocol to arbitrate and notify Peer devices whether there is
interference with its normal transmitting and receiving of packets. The protocol is
available for ESP32-S2 and the following series of SoCs (ESP Wi-Fi).
To implement the protocol, it is necessary to adopt a reasonable external coexistence
priority policy and determine the timing duration of key packets, to ensure proper
operation of ESP Wi-Fi and to limit the interference with the interaction behavior of Peer
devices.
Implementation of coexistence of Peer devices using different communication protocol
specifications is similar to implementation on a single dual-mode, dual-baseband SoC.
In other words, two sets of RF modules and baseband modules can receive packets of
different protocols in the 2.4 GHz ISM simultaneously. So, there will be less interference
compared with the coexistence of single-mode SoC.
If separate devices are used, there are two design differences from internal
coexistence.
• Internal interface needs to be called to check if the current Wi-Fi channel
conflicts with the communication channel of the Peer device, and decide
whether to enable the function of external coexistence.
• Since there are two sets of basebands, Wi-Fi sleep mode is optional and it is
possible that both devices transmit packets at the same time. Then it is
necessary to configure the internal coexistence timer to set the PTI (Packet
Type Identifier) of the 2.4 GHz band coexistence to achieve the function of
arbitrating and transmitting packets with the Peer device.

Espressif 1/11 Aug 2022


Submit Documentation Feedback
Chapter 2. Architecture Design

2. Architecture Design
Currently Espressif offers three coexistence modes with Peer devices: 1-wire, 2-wire
and 3-wire. For detailed description of these three modes, please refer to the table
below.
Table 2-1. Three Coexistence Modes

Coexistence PTA Signals


PTI Level
Mode Request Grant Priority

1-wire ✅ ❌ ❌ Always high level

2-wire ✅ ✅ ❌ Always low level

3-wire ✅ ✅ ✅ Selectable low/high level

2.1. Mapping of Coexistence Modes and PTA (Packet Traffic


Arbitration) Signals

2.1.1. 1-wire mode

request Hardware
Peer device coexistence ESP
arbitrator Wi-Fi
module

Figure 2-1. 1-wire Mode

In 1-wire mode, Peer device transmits a request signal to ESP Wi-Fi, where Peer device
triggers request whenever it needs the 2.4 GHz ISM band and expects ESP Wi-Fi to
always yield. This mode works very well for the Peer device, but high priority ESP Wi-Fi
traffic can be compromised which impacts ESP Wi-Fi performance.
Since PTI level for 1-wire mode is always high level, arbitration results are not required
after Peer device triggers a request.

Espressif 2/11 Aug 2022


Submit Documentation Feedback
Chapter 2. Architecture Design

2.1.2. 2-wire mode

request
Hardware
Peer device coexistence ESP
grant arbitrator Wi-Fi
module

Figure 2-2. 2-wire Mode

In 2-wire mode, the request is extended with the grant signal, allowing the Peer device
to request the 2.4 GHz ISM band. The arbitration results are received through grant
signal.
The ESP Wi-Fi internally controls the prioritization with the Peer device, and on a
conflict, the Hardware coexistence arbitrator module can analyze which device (Peer
device or ESP Wi-Fi) is permitted to access to the ISM band.

2.1.3. 3-wire mode

request
Hardware
priority coexistence ESP
Peer device arbitrator Wi-Fi
grant module

Figure 2-3. 3-wire Mode

In 3-wire mode, the priority signal is added, allowing the Peer device to signify a high or
middle level behavior being performed.
The table below shows how to set PTI level through controlling the level of request and
priority signals:
Table 2-2. Set PTI Level Through Request and Priority Signals

PTI Level Request Priority

Middle Level GPIO voltage high GPIO voltage low

High Level GPIO voltage high GPIO voltage high

Espressif 3/11 Aug 2022


Submit Documentation Feedback
Chapter 2. Architecture Design

Note:

GPIO voltage is high when 3.3 V are supplied to the related GPIO pin.

Figure 2-4. 3-wire Timing Sequence

The above figure shows that the ESP Wi-Fi compares this external priority request,
which may be Middle/High level, against the internal Wi-Fi priority and can choose to
grant access to ISM band to either Peer device or ESP Wi-Fi.

2.1.4. Coexistence Signaling Timing Information


For 1-wire/2-wire/3-wire mode, the typical time delay from triggering request signal by
peer device to de-asserting the PHY signal by ESP Wi-Fi device can be in the range of
350 ns ~ 450 ns.
For 3-wire mode, the typical time delay from PTI signal assertion to grant signal output
can be in the range of 50 ns ~ 150 ns. The screenshot below shows that when PTI level
is high in 3-wire mode, the time delay between PTI signal assertion by Peer device and
grant signal output by ESP Wi-Fi device is 50 ns.
When the grant signal is high, Peer device can perform RF activity. And when the grant
signal is low, ESP Wi-Fi device can transmit/receive packets.
In contrast, when the PHY signal is high, it means ESP Wi-Fi device is able to
transmit/receive packets. When the PHY signal is low, it means ESP Wi-Fi device
cannot transmit/receive packets. ESP Wi-Fi will start working again until PHY signal
goes high. Please note that PHY signal is ESP Wi-Fi’s internal signal, which is not
available for the Peer device. When grant signal goes high, the PHY signal will go low at
the same time and vice versa.

Espressif 4/11 Aug 2022


Submit Documentation Feedback
Chapter 2. Architecture Design

Figure 2-5. 3-wire Timing Diagram

Note:
The test above is conducted with ESP32-S2 chip. The same result can be expected when the PTI
level is middle or high in 3-wire mode.

2.2. Coexistence PTA (Packet Traffic Arbitration) Flow

Wi-Fi Coexistence
Wi-Fi protocol 1 2
PHY
transmit/receive priority timer 4
stack
control control

5
Hardware
5 coexistence
arbitrator
module
5
Peer device GPIO
3 4 Wi-Fi chipset

Figure 2-6. Coexistence PTA Flow

1. Wi-Fi protocol stack triggers the request of transmit/receive to Wi-Fi transmit/receive


control.

Espressif 5/11 Aug 2022


Submit Documentation Feedback
Chapter 2. Architecture Design

2. Wi-Fi protocol stack uses the coexistence priority timer control in ESP Wi-Fi to set
proper PTI value based on specific scenario. The PTI value will be transferred to
corresponding PTI level automatically later.
3. The Peer device outputs either high or low level through a GPIO pin to select PTI
level and obtains arbitration results from ESP Wi-Fi by reading signal from another
GPIO pin. The number of GPIOs offered by ESP Wi-Fi to communicate with the Peer
device is in the range of one to three depending on the chosen mode.
4. ESP Wi-Fi internal hardware coexistence arbitration module compares internal PTI
level with the level obtained from the Peer device.
5. Arbitration results are provided to PHY and the GPIO at the same time. Based on
arbitration results, PHY will decide whether to transmit/receive packets and GPIO will
output high/low level to the Peer device. High level means that the Peer device can
transmit/receive packets, and low level means that ESP Wi-Fi can transmit/receive
packets.

2.3. Wi-Fi Key Packets


To ensure that the ESP Wi-Fi stays connected and works properly, an internal default
priority has been set.
When the ESP Wi-Fi is connecting, the priority of this process will be higher than the
middle level and lower than the high level request from Peer device.
When the ESP Wi-Fi is connected, the priority of the receiving beacon will be lower than
the high level request from Peer device.
It should be noted that the highest PTI value for Wi-Fi is less than the high level PTI
value of external coexistence.

Espressif 6/11 Aug 2022


Submit Documentation Feedback
Chapter 3. Design Implementation

3. Design Implementation
3.1. Software interfaces in ESP-IDF
When configuring for the coexistence feature, please make sure to use release/v4.3 or
newer release of ESP-IDF. The following screenshot shows how to configure external
hardware coexistence in menuconfig:

Figure 3-1. Configure External Hardware Coexistence in Menuconfig

After the hardware external coexistence is configured in menuconfig, it is still necessary


to set the relevant GPIO pins and PTI level by calling the following interfaces:
• esp_enable_extern_coex_gpio_pin:
By calling on the function esp_err_t
esp_enable_extern_coex_gpio_pin(wire_type, gpio_pin), you can input 1-
wire/2-wire/3-wire for the “wire_type”, and the available pin number for “gpio_pin”. For
available pin numbers, please refer to the ESP-IDF Programming Guide > API
Reference > Peripherals API > GPIO & RTC GPIO.
1. Enable GPIO pin;
2. Set GPIO pin in/out direction. By configuring the high and low level of pin in,
Peer device can transmit request and PTI level to ESP Wi-Fi. By configuring
GPIO pin out, the ESP Wi-Fi's hardware coexistence arbitrator module will
provide feedback on the current arbitration result based on the PTI level and
the Wi-Fi internal priority. If pin out outputs low level (0), it indicates that the
ESP Wi-Fi can communicate properly. If pin out outputs high level (1), it
indicates that the Peer device can communicate properly.
3. Establish the map between PTI value and PTI level.

Espressif 7/11 Aug 2022


Submit Documentation Feedback
Chapter 3. Design Implementation

Notice:

• For specific scenario of Peer device, if users want to keep the duration time of PTI level, they can
set related GPIO pin high/low through their alarm/timer or other similar function unit.

• esp_disable_extern_coex_gpio_pin:
By calling on the function esp_err_t esp_disable_extern_coex_gpio_pin(),
users can clear the configured priority for external coexistence and disable all
configured pins.

Espressif 8/11 Aug 2022


Submit Documentation Feedback
Chapter 4. Q&A

4. Q&A
If there are any other questions regarding the software interaction between the Wi-Fi
device and the Peer device, please feel free to contact us.

Espressif 9/11 Aug 2022


Submit Documentation Feedback
Chapter 4. Q&A

Appendix A. Terminology
Table A-1. Terminology

Term Description

Coexistence priority timer Part of ESP Wi-Fi hardware which keeps PTI value for configurable
control duration time.

ESP Wi-Fi Espressif’s SoC (All chip series, except ESP8266 and ESP32
series).

Hardware coexistence Part of ESP Wi-Fi hardware. It compares the PTI value from Peer
arbitrator module device and Wi-Fi scenario module to select device to access the
ISM band.

ISM The Industrial, Scientific, and Medical (ISM) frequency bands.

Peer device The 2.4 GHz device that shares ISM band with ESP Wi-Fi and
communicates priority information through GPIO interface.

PTA Packet Traffic Arbitration. PTA is described in IEEE 802.15.2 (2003)


Clause 6 and is a recommendation, not a standard.

PTI Packet Type Identifier.

PTI value & PTI level The Packet Type Identifier value will be used as raw data for
hardware coexistence arbitrator module. PTI level is mapped to
corresponding PTI value.

Espressif 10/11 Aug 2022


Submit Documentation Feedback
Disclaimer and Copyright Notice
Information in this document, including URL references, is subject to change without notice.
ALL THIRD PARTY’S INFORMATION IN THIS DOCUMENT IS PROVIDED AS IS WITH NO
WARRANTIES TO ITS AUTHENTICITY AND ACCURACY.
NO WARRANTY IS PROVIDED TO THIS DOCUMENT FOR ITS MERCHANTABILITY, NON-
INFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, NOR DOES ANY WARRANTY
OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.
All liability, including liability for infringement of any proprietary rights, relating to use of
information in this document is disclaimed. No licenses express or implied, by estoppel or
otherwise, to any intellectual property rights are granted herein.
The Wi-Fi Alliance Member logo is a trademark of the Wi-Fi Alliance. The Bluetooth logo is a
registered trademark of Bluetooth SIG.
All trade names, trademarks and registered trademarks mentioned in this document are property
of their respective owners, and are hereby acknowledged.
www.espressif.com
Copyright © 2022 Espressif Systems (Shanghai) Co., Ltd. All rights reserved.

You might also like