This method to scan for WIFI access points appears not to work. Just returns an empty string array. All other methods in Winc15x0Interface appear to work as they should.
I have implemented code as per the documentation and can connect to an access point no issue. However the scan method does not work.
We need simple project to see what wrong with your code.
We just tested again and work fine
Here is the full code I am using:
//set pis
var enablePinNumber = SC20260.GpioPin.PI5;
var chipSelectPinNumber = SC20260.GpioPin.PC13;
var irqPinNumber = SC20260.GpioPin.PJ13;
var resetPinNumber = SC20260.GpioPin.PI11;
var spiControllerName = SC20260.SpiBus.Spi3;
var gpioControllerName = SC20260.GpioPin.Id;
//enable
var enablePin = GpioController.GetDefault().OpenPin(enablePinNumber);
enablePin.SetDriveMode(GpioPinDriveMode.Output);
enablePin.Write(GpioPinValue.High);
SpiNetworkCommunicationInterfaceSettings netInterfaceSettings =
new SpiNetworkCommunicationInterfaceSettings();
var chipselect = GpioController.GetDefault().OpenPin(chipSelectPinNumber);
var settings = new SpiConnectionSettings()
{
ChipSelectLine = chipselect,
ClockFrequency = 4000000,
Mode = SpiMode.Mode0,
ChipSelectType = SpiChipSelectType.Gpio,
ChipSelectHoldTime = TimeSpan.FromTicks(10),
ChipSelectSetupTime = TimeSpan.FromTicks(10)
};
// netInterfaceSettings
netInterfaceSettings.SpiApiName = spiControllerName;
netInterfaceSettings.SpiSettings = settings;
netInterfaceSettings.GpioApiName = gpioControllerName;
netInterfaceSettings.InterruptPin = GpioController.GetDefault().OpenPin(irqPinNumber);
netInterfaceSettings.InterruptEdge = GpioPinEdge.FallingEdge;
netInterfaceSettings.InterruptDriveMode = GpioPinDriveMode.InputPullUp;
netInterfaceSettings.ResetPin = GpioController.GetDefault().OpenPin(resetPinNumber);
netInterfaceSettings.ResetActiveState = GpioPinValue.Low;
var networkController = NetworkController.FromName(SC20260.NetworkController.ATWinc15x0);
networkController.SetCommunicationInterfaceSettings(netInterfaceSettings);
networkController.SetAsDefaultController();
//Scan for WiFi access points:
string[] ssidList = Winc15x0Interface.Scan();
Debug.WriteLine("Networks Found: " + ssidList.Length);
foreach (String str in ssidList)
{
Debug.Write(str);
}
Thread.Sleep(5000);
All i get is an empty string array and Networks Found: 0
Hi, we have tried your code, it works fine without changing anything. Can you check your wifi module version?
Below we add code to check version. Make sure you have same version.
...
networkController.SetCommunicationInterfaceSettings(netInterfaceSettings);
networkController.SetAsDefaultController();
//GHI added
var version = Winc15x0Interface.GetFirmwareVersion();
Debug.WriteLine("Version : " + version);
//Scan for WiFi access points:
string[] ssidList = Winc15x0Interface.Scan();
Debug.WriteLine("Networks Found: " + ssidList.Length);
foreach (String str in ssidList)
{
Debug.WriteLine(str);
}
...
Are you broadcasting your SSID? Is your wifi compatible with what types supported by the module? No 5Gz for example!