Does anyone have an example of getting this to work? I must be missing something.
I am using SCM20260D Dev board Rev C with a WiFi 7 Click.
I have been able to get the WiFi to connect to an access point and get an IP address. However when I call Winc15x0Interface.Scan();
All I get is an empty array where there should be a list of access points.
I have already called SetCommunicationInterfaceSettings
All of the other functions in Winc15x0Interface appear to work such as getting firmware, MAC address etc.
Mike
2
Does any of this help?
https://docs.ghielectronics.com/software/tinyclr/tutorials/wifi.html
A sample of your non-functioning code is always helpful…
1 Like
Code that I am using is from that page:
//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);
I just get Networks Found: 0