mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp32: add multiple antenna
1. Support multiple antenna support 2. libphy.a is updated to v3910
This commit is contained in:
@@ -1420,6 +1420,61 @@ The Wi-Fi sniffer mode can be enabled in the Wi-Fi mode of WIFI_MODE_NULL, or WI
|
||||
|
||||
Another noteworthy issue about the sniffer is the callback wifi_promiscuous_cb_t. The callback will be called directly in the Wi-Fi driver task, so if the application has a lot of work to do for each filtered packet, the recommendation is to post an event to the application task in the callback and defer the real work to the application task.
|
||||
|
||||
Wi-Fi Multiple Antennas
|
||||
--------------------------
|
||||
The Wi-Fi multiple antennas selecting can be depicted as following picture::
|
||||
|
||||
__________
|
||||
|Enabled |
|
||||
___|Antenna 0 |\\ _________
|
||||
|__________| \\ GPIO[0] <----> antenna_select[0] ---| | --- antenna 0
|
||||
RX/TX ___ \\____\ GPIO[1] <----> antenna_select[1] ---| Antenna | --- antenna 1
|
||||
\ __________ // / GPIO[2] <----> antenna_select[2] ---| Switch | ... ...
|
||||
\ ___|Enabled | // GPIO[3] <----> antenna_select[3] ---|_________| --- antenna 15
|
||||
\ |Antenna 1 |//
|
||||
|__________|
|
||||
|
||||
|
||||
ESP32 supports up to sixteen antennas through external antenna switch. The antenna switch can be controlled by up to four address pins - antenna_select[0:3]. Different input value of antenna_select[0:3] means selecting different antenna. E.g. the value '0b1011' means the antenna 11 is selected. The default value of antenna_select[3:0] is '0b0000', it means the antenna 0 is selected by default.
|
||||
|
||||
Up to four GPIOs are connected to the four active high antenna_select pins. ESP32 can select the antenna by control the GPIO[0:3]. The API :cpp:func:`esp_wifi_set_ant_gpio()` is used to configure which GPIOs are connected to antenna_selects. If GPIO[x] is connected to antenna_select[x], then gpio_config->gpio_cfg[x].gpio_select should be set to 1 and gpio_config->gpio_cfg[x].gpio_num should be provided.
|
||||
|
||||
Although up to sixteen anteenas are supported, only one or two antennas can be simultaneously enabled for RX/TX. The API :cpp:func:`esp_wifi_set_ant()` is used to configure which antennas are enabled.
|
||||
|
||||
The enabled antennas selecting algorithm is also configured by :cpp:func:`esp_wifi_set_ant()`. The RX/TX antenna mode can be WIFI_ANT_MODE_ANT0, WIFI_ANT_MODE_ANT1 or WIFI_ANT_MODE_AUTO. If the antenna mode is WIFI_ANT_MODE_ANT0, the enabled antenna 0 is selected for RX/TX data. If the antenna mode is WIFI_ANT_MODE_ANT1, the enabled antenna 1 is selected for RX/TX data. Otherwise, WiFi automatically selects the antenna that has better signal from the enabled antennas.
|
||||
|
||||
If the RX antenna mode is WIFI_ANT_MODE_AUTO, the default antenna mode also needs to be set. Because the RX antenna switching only happens when some conditions are met, e.g. the RX antenna starts to switch if the RSSI is lower than -65dBm and if another antenna has better signal etc, RX uses the default antenna if the conditions are not met. If the default antenna mode is WIFI_ANT_MODE_ANT1, the enabled antenna 1 is used as the default RX antenna, otherwise the enabled antenna 0 is used as the default RX antenna.
|
||||
|
||||
Some limitations need to be considered:
|
||||
- The TX antenna can be set to WIFI_ANT_MODE_AUTO only if the RX antenna mode is WIFI_ANT_MODE_AUTO because TX antenna selecting algorithm is based on RX antenna in WIFI_ANT_MODE_AUTO type.
|
||||
- Currently BT doesn't support the multiple antennas feature, please don't use multiple antennas related APIs.
|
||||
|
||||
Following is the recommended scenarios to use the multiple antennas:
|
||||
- In Wi-Fi mode WIFI_MODE_STA, both RX/TX antenna modes are configured to WIFI_ANT_MODE_AUTO. The WiFi driver selects the better RX/TX antenna automatically.
|
||||
- The RX antenna mode is configured to WIFI_ANT_MODE_AUTO. The TX antenna mode is configured to WIFI_ANT_MODE_ANT0 or WIFI_ANT_MODE_ANT1. The applications can choose to always select a specified antenna for TX, or implement their own TX antenna selecting algorithm, e.g. selecting the TX antenna mode based on the channel switch information etc.
|
||||
- Both RX/TX antenna modes are configured to WIFI_ANT_MODE_ANT0 or WIFI_ANT_MODE_ANT1.
|
||||
|
||||
|
||||
Wi-Fi Multiple Antennas Configuration
|
||||
+++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Generally, following steps can be taken to configure the multiple antennas:
|
||||
- Configure which GPIOs are connected to the antenna_selects, for example, if four antennas are supported and GPIO20/GPIO21 are connected to antenna_select[0]/antenna_select[1], the configurations look like::
|
||||
|
||||
wifi_ant_gpio_config_t config = {
|
||||
{ .gpio_select = 1, .gpio_num = 20 },
|
||||
{ .gpio_select = 1, .gpio_num = 21 }
|
||||
};
|
||||
- Configure which antennas are enabled and how RX/TX use the enabled antennas, for example, if antenna1 and antenna3 are enabled, the RX needs to select the better antenna automatically and uses antenna1 as its default antenna, the TX always selects the antenna3. The configuration looks like::
|
||||
|
||||
wifi_ant_config_t config = {
|
||||
.rx_ant_mode = WIFI_ANT_MODE_AUTO,
|
||||
.rx_ant_default = WIFI_ANT_ANT0,
|
||||
.tx_ant_mode = WIFI_ANT_MODE_ANT1,
|
||||
.enabled_ant0 = 1,
|
||||
.enabled_ant1 = 3
|
||||
};
|
||||
|
||||
Wi-Fi Buffer Usage
|
||||
--------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user