CHIP_EN is on a GPIO as in your wifi example… the problem is that I have 10 WINC modules purchased in March which are not working.
The program (the WiFi example of your site) and the self-built card works with :
- a WINC removed from your Fez Feather
- a WINC removed from a Mikroe Click 7
… but not with 2 of the 10 ATWINC1500-MR210PB1952 just purchased.
The error is generated with or without the module as if the bus were disconnected.
var en = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PC7);
en.SetDriveMode(GpioPinDriveMode.Output); en.Write(GHIElectronics.TinyCLR.Devices.Gpio.GpioPinValue.High);
SpiNetworkCommunicationInterfaceSettings netInterfaceSettings = new SpiNetworkCommunicationInterfaceSettings();
var cs = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PE0);
var settings = new SpiConnectionSettings()
{
ChipSelectLine = cs,
ClockFrequency = 4000000,
Mode = SpiMode.Mode0,
ChipSelectType = SpiChipSelectType.Gpio,
ChipSelectHoldTime = TimeSpan.FromTicks(10),
ChipSelectSetupTime = TimeSpan.FromTicks(10)
};
netInterfaceSettings.SpiApiName = SC20100.SpiBus.Spi3;
netInterfaceSettings.GpioApiName = SC20100.GpioPin.Id;
netInterfaceSettings.SpiSettings = settings;
netInterfaceSettings.InterruptPin = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PB6); // HWPINS.ETH_INT_Pin;
netInterfaceSettings.InterruptEdge = GpioPinEdge.FallingEdge;
netInterfaceSettings.InterruptDriveMode = GpioPinDriveMode.InputPullUp;
netInterfaceSettings.ResetPin = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PD6); // HWPINS.ETH_RST_Pin;
netInterfaceSettings.ResetActiveState = GpioPinValue.Low;
var networkController = NetworkController.FromName(SC20100.NetworkController.ATWinc15x0);
WiFiNetworkInterfaceSettings wifiSettings = new WiFiNetworkInterfaceSettings()
{
Ssid = "mynetworksid",
Password = "mynetworkpass",
};
wifiSettings.Address = new IPAddress(new byte[] { 192, 168, 1, 122 });
wifiSettings.SubnetMask = new IPAddress(new byte[] { 255, 255, 255, 0 });
wifiSettings.GatewayAddress = new IPAddress(new byte[] { 192, 168, 1, 200 });
wifiSettings.DnsAddresses = new IPAddress[] { new IPAddress(new byte[]{ 75, 75, 75, 75 }),
new IPAddress(new byte[] { 75, 75, 75, 76 }) };
wifiSettings.MacAddress = new byte[] { 0x0C, 0x4, 0x0B, 0x10, 0x20, 0x00 };
wifiSettings.DhcpEnable = true;
wifiSettings.DynamicDnsEnable = true;
networkController.SetInterfaceSettings(wifiSettings);
networkController.SetCommunicationInterfaceSettings(netInterfaceSettings);
networkController.SetAsDefaultController();
networkController.NetworkAddressChanged += NetworkController_NetworkAddressChanged;
networkController.NetworkLinkConnectedChanged += NetworkController_NetworkLinkConnectedChanged;
networkController.Enable();