.netesp32nanoframework

nanoframework esp32 wifi connection fails


I am trying to connect to wifi using esp32 nanoframework. Have tried various samples, for example: https://github.com/nanoframework/Samples/blob/main/samples/Wifi/ScanWiFi/Program.cs

I am getting the below exception on this line:

WifiAdapter wifi = WifiAdapter.FindAllAdapters()[0];

Exception:

Starting Wifi scan
    ++++ Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ++++
    ++++ Message: 
    ++++ System.Device.Wifi.WifiAdapter::NativeScanAsync [IP: 0000] ++++
    ++++ System.Device.Wifi.WifiAdapter::ScanAsync [IP: 000d] ++++
Exception thrown: 'System.InvalidOperationException' in System.Device.Wifi.dll
message:Exception was thrown: System.InvalidOperationException
stack:System.Device.Wifi.WifiAdapter::NativeScanAsync
System.Device.Wifi.WifiAdapter::ScanAsync

I have tried various things such as


Solution

  • So looks like it was an issue to do with the same SSID on 5GHz as I had on 2.4GHz.

    Things I looked at that weren't actually necessary to get it working

    The only thing was that the esp should connect to the SSID on 2.4GHz and not the same one on 5GHz.