Skip to content

wifi: fix esp32 dual antenna issue #6841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2022

Conversation

MaxwellAlan
Copy link
Contributor

@MaxwellAlan MaxwellAlan commented Jun 7, 2022

Background

Issue Descrition

image

image

According to the schematics of ESP32-WROOM-DA, there is no inverter chip(SN74AUP1G04 is NC), which means that we should use two gpio(pin 2 & pin 25) to control RTC6603SP.
While the true table of RTC6603SP shows that we only input with 1 & 0 or 0 & 1, 0 & 0 or 1 & 1 are invalid.
According to idf docs: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html?highlight=antenna#wi-fi-multiple-antennas , below sample code means(comments inline):

wifi_ant_gpio_config_t ant_gpio_config = {
    // ESP32-WROOM-DA boards default antenna pins
    .gpio_cfg[0] = { .gpio_select = 1, .gpio_num = 2 },
    .gpio_cfg[1] = { .gpio_select = 1, .gpio_num = 25 },
};

wifi_ant_config_t ant_config = {
    .rx_ant_mode = WIFI_ANT_MODE_ANT0,
    .rx_ant_default = WIFI_ANT_ANT0, // only used when rx_ant_mode = auto
    .tx_ant_mode = WIFI_ANT_MODE_ANT1,
    .enabled_ant0 = 1, // When internal ant0 enabled, then gpio_cfg = 1 = 0b0001 -> pin 2 high level
    .enabled_ant1 = 2  // When internal ant1 enabled, then gpio_cfg = 2 = 0b0010 -> pin 25 high level
};

Description of Change

WiFi: fix esp32 dual antenna not real work issue.

Tests scenarios

Since the gpio 2 is not led out to the module, so we test with gpio 18 & 25.

wifi_ant_gpio_config_t ant_gpio_config = {
    // ESP32-WROOM-DA boards default antenna pins
    .gpio_cfg[0] = { .gpio_select = 1, .gpio_num = 18 },
    .gpio_cfg[1] = { .gpio_select = 1, .gpio_num = 25 },
};

wifi_ant_config_t ant_config = {
    .rx_ant_mode = WIFI_ANT_MODE_ANT0,
    .rx_ant_default = WIFI_ANT_ANT0, // only used when rx_ant_mode = auto
    .tx_ant_mode = WIFI_ANT_MODE_ANT1,
    .enabled_ant0 = 1, // When internal ant0 enabled, then gpio_cfg = 1 = 0b0001 -> pin 2 high level
    .enabled_ant1 = 2  // When internal ant1 enabled, then gpio_cfg = 2 = 0b0010 -> pin 25 high level
};

Test Result

016
pin18_and_pin25.csv

Related links

https://www.youtube.com/watch?v=F0u5qIwwY1k

espressif/esp-idf#8824

@CLAassistant
Copy link

CLAassistant commented Jun 7, 2022

CLA assistant check
All committers have signed the CLA.

@me-no-dev
Copy link
Member

Please explain well what was the issue, how does it behave differently now and so on.

@pedrominatel PTAL

@me-no-dev me-no-dev requested a review from pedrominatel June 7, 2022 15:38
@MaxwellAlan
Copy link
Contributor Author

Please explain well what was the issue, how does it behave differently now and so on.

@pedrominatel PTAL
OK,will add some more details. :)

@pedrominatel
Copy link
Member

Thank you for the detailed information about the issue and the solution, @MaxwellAlan.

Can you re-test, @SensorsIot?

@pedrominatel
Copy link
Member

My test results:

  • Without the fix: ~6 networks
  • With the fix: ~14 networks

Running time on each scenario: 5 min.

Log output:

Before fix

scan start
scan done
6 networks found
1: Umbrella_Corp (-75)*
2: IoTNetwork (-78)*
3: MEO-989F10 (-79)*
4: MEO-WiFi (-80) 
5: NOS-E6BD (-82)*
6: Vodafone-FA65BB (-88)*

After fix

scan start
scan done
14 networks found
1: Umbrella_Corp (-69)*
2: IoTNetwork (-69)*
3: NOS-E6BD (-83)*
4: MEO-WiFi (-85) 
5: MEO-989F10 (-86)*
6: B.D (-86)*
7: Vodafone-FA65BB (-86)*
8: IoTNetwork (-88)*
9: Vodafone-5A5DA6 (-89)*
10: Vodafone-F9BD6A (-90)*
11: MEO-WiFi (-91) 
12: Umbrella_Corp (-92)*
13: Vodafone-F9BD6A (-94)*
14: MEO-528A90 (-95)*

Copy link
Member

@pedrominatel pedrominatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@me-no-dev me-no-dev merged commit 7991110 into espressif:master Jun 12, 2022
@me-no-dev
Copy link
Member

Thanks @MaxwellAlan and @pedrominatel

@SensorsIot
Copy link

Cool. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants