Hello everyone.
I’m currently running a test project with ESP32-C5-DevKitC-1-N8R4,
but I’m encountering a runtime error.
I’ve tried to fix it, but I’m not sure if it’s the right solution.
Can someone tell me the best solution?
The build completed (although the message esp_idf_size: error: unrecognized arguments: --ng appears when linking),
but I’m able to load and run the code on the device.
[Status]
Runtime Error
When WiFi.mode(WIFI_STA) was executed, the following message was output to the Serial port: “E (1117) wifi: can’t get wifi protocol under WiFi band mode WIFI_BAND_MODE_AUTO, please use esp_wifi_get_protocols instead”
After this message was output, I performed a dual-band network scan, but there didn’t seem to be any problems and no error messages were displayed.
Current Solution
In (myhome)/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiGeneric.cpp,
I changed two occurrences of “esp_wifi_get_protocol(WIFI_IF_STA,(uint8_t *)¤t_protocol)”
to “esp_wifi_get_protocols(WIFI_IF_STA,(wifi_protocols_t *)¤t_protocol)”
within bool WiFiGenericClass::mode(wifi_mode_t m).
This fix no longer causes runtime errors, but I’m not sure if it was appropriate.
Thank you so much for your quick response, Boris!
It’s very helpful.
I’ll consider posting a separate comment about your suggested community.
For now, I’ve modified the library source code to allow conditional compilation.
This modification should make the code compatible with both the ESP32-C5, which supports the 5GHz band, and other devices that only support the 2.4GHz band, I think.
bidrohini
Thank you for your response.
The link you specified is just for “ESP32”, I think.
The issue is on “ESP32-C5” : 2.4GHz/5GHz available.
In addition, no problem on ESP32-C6 (2.4GHz only).
I think the meaning of error message is as “Use esp_wifi_get_protocols() instead of esp_wifi_get_protocol()”.
esp_wifi_get_protocol() is used in “WiFiGeneric.cpp” of core library.