ESP32-Long-Range-WiFi icon indicating copy to clipboard operation
ESP32-Long-Range-WiFi copied to clipboard

Don't forget to reset to normal mode(beware)

Open jitendra1607 opened this issue 3 years ago • 3 comments

i used slave.ino for experiment, then after some time I flashed another program in esp32 but it didn't connected to wifi. I tried many ways but lastly I had to reset the mode to "WIFI_PROTOCOL_11B" once, after that it is working as new.

jitendra1607 avatar Sep 10 '21 16:09 jitendra1607

I had the same issue. One should probably do this.

// WIFI_IF_STA or WIFI_IF_AP depending on which side you previously set the protocol
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

or all of them.

// WIFI_IF_STA or WIFI_IF_AP depending on which side you previously set the protocol
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR);

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html?highlight=wifi_protocol_lr#lr-compatibility

LR Compatibility Since LR is Espressif unique Wi-Fi mode, only ESP32 devices can transmit and receive the LR data. In other words, the ESP32 device should NOT transmit the data in LR data rate if the connected device doesn’t support LR. The application can achieve this by configuring suitable Wi-Fi mode. If the negotiated mode supports LR, the ESP32 may transmit data in LR rate, otherwise, ESP32 will transmit all data in traditional Wi-Fi data rate.

https://docs.platformio.org/en/latest/platforms/espressif32.html#erase-flash

This may also help when you have wired issues.

github0013 avatar Jan 06 '22 11:01 github0013

I had the same issue. One should probably do this.

// WIFI_IF_STA or WIFI_IF_AP depending on which side you previously set the protocol
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

or all of them.

// WIFI_IF_STA or WIFI_IF_AP depending on which side you previously set the protocol
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR);

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html?highlight=wifi_protocol_lr#lr-compatibility

LR Compatibility Since LR is Espressif unique Wi-Fi mode, only ESP32 devices can transmit and receive the LR data. In other words, the ESP32 device should NOT transmit the data in LR data rate if the connected device doesn’t support LR. The application can achieve this by configuring suitable Wi-Fi mode. If the negotiated mode supports LR, the ESP32 may transmit data in LR rate, otherwise, ESP32 will transmit all data in traditional Wi-Fi data rate.

https://docs.platformio.org/en/latest/platforms/espressif32.html#erase-flash

This may also help when you have wired issues.

How do you get it to compile? It does not accept the pipes.

wifi:68:101: error: expression list treated as compound expression in initializer [-fpermissive] esp_err_t esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N);

Zzo911 avatar Dec 03 '22 19:12 Zzo911

I am using platformio, and it's in C++.

My platformio.ini

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DCORE_DEBUG_LEVEL=5
monitor_speed = 115200

https://github.com/espressif/esp-idf/blob/d11ee31bf119400a5eb366f7882c4238e85b107e/components/esp_wifi/include/esp_wifi.h#L527

The comment doc is also using the same way. https://github.com/espressif/esp-idf/blob/d11ee31bf119400a5eb366f7882c4238e85b107e/components/esp_wifi/include/esp_wifi.h#L514

And I believe piping numbers is just adding numbers in binary.

000 = 0
001 = 1
010 = 2
011 = 3
...

https://github.com/espressif/esp-idf/blob/d11ee31bf119400a5eb366f7882c4238e85b107e/components/esp_wifi/include/esp_wifi_types.h#L231-L234

github0013 avatar Dec 04 '22 00:12 github0013