espressif / ESP8266_NONOS_SDK

ESP8266 nonOS SDK
Other
929 stars 535 forks source link

ESP can't connect on Channel 13 and wifi_set_country() has no effect #300

Open sezeryalcin opened 4 years ago

sezeryalcin commented 4 years ago

This issue was reported to ESP8266 Arduino Core but they claim it's an SDK issue. So I came here.

I upgraded to 2.6.3 from 2.5.2 and now I am not able to connect to APs and other ESPs using wifi channel 13. Looks like they also upgraded NONOS_SDK along.

Looks like default is restricted to US channels (1-11) but users should be able to change it according to country they are in.

I updated my code to change country and settings but this has no effect.

wifi_country_t mycountry = { .cc = "CN", .schan = 1, .nchan = 13, .policy = WIFI_COUNTRY_POLICY_MANUAL, }; wifi_set_country(&mycountry);

Is there are general restriction on channels 12,13,14 or some policy changed? I was using ch 13 and now cannot and I am not in US. This caused backward incompatible problems which is not tasty.

Here is how I set up AP ESP (wemos d1 mini)

AP SIDE code:

IPAddress _apip(192, 168, 50, 1); IPAddress _subnet(255, 255, 255, 0);

WiFi.mode(WIFI_AP); WiFi.setSleepMode(WIFI_NONE_SLEEP); WiFi.softAPConfig(_apip, _apip, _subnet);

WiFi.softAP("SOMESSID", "somepsk123", 13, true, 2); // 12 and 13 doesn't work

Client SIDE code:

wifi_country_t mycountry = { .cc = "CN", .schan = 1, .nchan = 13, .policy = WIFI_COUNTRY_POLICY_MANUAL, };

wifi_set_country(&mycountry); WiFi.begin("SOMESSID", "somepsk123");

sezeryalcin commented 4 years ago

Is there a correct way to enable channel 13?