esp-idf: LR mode not being applied (IDFGH-8473)

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

4.4.2

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

No response

Development Kit.

TTGO

Power Supply used.

USB

What is the expected behavior?

I want the Station to be able to connect in all modes (“protocols”), i.e. B, G, N or LR.

https://docs.espressif.com/projects/esp-idf/en/v4.4.2/esp32/api-guides/wifi.html#wi-fi-protocol-mode

Call esp_wifi_set_protocol(ifx, WIFI_PROTOCOL_11B| WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) to set the station/AP to BGN and the LR mode.

What is the actual behavior?

Whenever WIFI_PROTOCOL_LR is included in the call to esp_wifi_set_protocol(), it is ignored.

Steps to reproduce.

According to esp_wifi_types.h:

#define WIFI_PROTOCOL_11B         1
#define WIFI_PROTOCOL_11G         2
#define WIFI_PROTOCOL_11N         4
#define WIFI_PROTOCOL_LR          8

When I call

esp_wifi_set_protocol(ESP_IF_WIFI_STA, 1);
esp_wifi_get_protocol(ESP_IF_WIFI_STA, &proto);
ESP_LOGI(TAG, "%d", proto);

esp_wifi_set_protocol(ESP_IF_WIFI_STA, 8);
esp_wifi_get_protocol(ESP_IF_WIFI_STA, &proto);
ESP_LOGI(TAG, "%d", proto);

esp_wifi_set_protocol(ESP_IF_WIFI_STA, 15);
esp_wifi_get_protocol(ESP_IF_WIFI_STA, &proto);
ESP_LOGI(TAG, "%d", proto);

the expected output is 1 8 15

However, the actual output is 1 0 7

Debug Logs.

No response

More Information.

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

@igrr @kriegste Checked again, esp_wifi_set_country() can be called after esp_wifi_init and before esp_wifi_start. But if the API is called before esp_wifi_start, the max tx power parameter can’t works, because this parameter need to set phy, and the phy can be operated after wifi start. This API esp_wifi_set_max_tx_power can be called to set max tx power after wifi start. https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html?highlight=set_max_tx#_CPPv425esp_wifi_set_max_tx_power6int8_t