ATWINC Access Point w/ DHCP

(this was a comment, figured it would be more helpful in its own thread as it’s unrelated to the root issue)

Hey team,
I have an ATWINC1500-MR210UB on a custom board in a device I’m working on. I have everything working in software, and my phone can see the access point, but now it (Samsung S10) can’t get an IP address from the unit properly. It appears to be trying to negotiate an IP address in the 192.168.2.X block which won’t work, as the DHCP defaults to 192.168.1.X on the SCM. Would this be something on my phone or would it be in the DHCP server in the network controller? if I set my phone to request a static IP it connects to the access point right away on my phone, but doesn’t fire the connection changed event and I can’t open a socket on the connection.

Has anyone had any experience setting up the wifi as an access point? is there something I’m missing?

Just tested with my Google 3A phone, works well so no broken on this feature.

Can I see code, simple as much as you can?

does your phone still set IP static?

it should be “192.168.1.X+1”

Just tried it on my laptop as well, it doesn’t seem to be working either so it must be in my setup.

For context, I have a manager that wraps the ethernet and wifi and only exposes the default network controller, and only one is intialized depending on a configuration setting stored in flash.

Chip firmware on this one is 19.6.2.


NetworkManager.InitializeWifi(ssid, pw, GHIElectronics.TinyCLR.Devices.Network.WiFiMode.AccessPoint, true);


public static bool InitializeWifi(string ssid, string pw, WiFiMode mode, bool useDynamic = false )
                if (netController != null)
                    catch (Exception e)
                        sendDebugMessage($"Failed to Disable controller");

                controller = GpioController.GetDefault();
                spi = SpiController.FromName(_spiControllerName);          

                _enablePin = controller.OpenPin(_enablePinNumber);
                _csPin = controller.OpenPin(_csPinNumber);

                sendDebugMessage($"Resetting WIFI module");

                sendDebugMessage($"Wifi hardware enabled");               

                var settings = new SpiConnectionSettings()
                    ChipSelectLine = _csPin,
                    ClockFrequency = 8_000_000,
                    Mode = SpiMode.Mode0,
                    ChipSelectType = SpiChipSelectType.Gpio,
                    ChipSelectHoldTime = TimeSpan.FromTicks(10),
                    ChipSelectSetupTime = TimeSpan.FromTicks(10)

                wifiCommSettings = new SpiNetworkCommunicationInterfaceSettings();

                wifiCommSettings.SpiApiName = _spiControllerName;
                wifiCommSettings.SpiSettings = settings;
                wifiCommSettings.GpioApiName = SC20260.GpioPin.Id;
                wifiCommSettings.InterruptPin = GpioController.GetDefault().OpenPin(_irqPinNumber);
                wifiCommSettings.InterruptEdge = GpioPinEdge.FallingEdge;
                wifiCommSettings.InterruptDriveMode = GpioPinDriveMode.InputPullUp;
                wifiCommSettings.ResetPin = GpioController.GetDefault().OpenPin(_resetPinNumber); 
                wifiCommSettings.ResetActiveState = GpioPinValue.Low;

                sendDebugMessage($"SPI Interface settings set");

                DNSServers[0] = new IPAddress(new byte[] { 8, 8, 8, 8 });
                DNSServers[1] = new IPAddress(new byte[] { 8, 8, 4, 4 });

                wifiNetSettings = new WiFiNetworkInterfaceSettings()
                    Password = pw,
                    Ssid = ssid,
                    Mode = WiFiMode.AccessPoint

                wifiNetSettings.DhcpEnable = useDynamic;
                wifiNetSettings.DynamicDnsEnable = useDynamic;

                if (wifiNetSettings.Mode == WiFiMode.AccessPoint)
                    wifiNetSettings.AccessPointClientConnectionChanged += (a, b, c) =>
                        sendDebugMessage($"Device {c} connected on IP {b.ToString()}");

                sendDebugMessage($"Initialized Wifi Settings - SSid = {ssid}, pw = {pw}");
                sendDebugMessage(useDynamic ? "Dynamic IPs enabled" : "Dynamic IPs Disabled");

                if (!useDynamic)
                    wifiNetSettings.Address = NetworkServer.LocalIP;
                    wifiNetSettings.GatewayAddress = NetworkServer.Gateway;
                    wifiNetSettings.SubnetMask = NetworkServer.SubnetMask;
                    wifiNetSettings.DnsAddresses = DNSServers;

                if (netController != null)

                    netController = null;

                netController = NetworkController.FromName(SC20260.NetworkController.ATWinc15x0);
                sendDebugMessage($"Controller Initialized");
                //handle net controller object


                sendDebugMessage($"Wifi Set As Default Controller");
                netController.NetworkLinkConnectedChanged += Connect_DisconnectEventHandler;
                netController.NetworkAddressChanged += IPChangedHandler;

                //sendDebugMessage("Firmware Version: " + Winc15x0Interface.GetFirmwareVersion());


                // programmatic equivalent of turning it off and back on again, if I don't do this the network never shows up.


                sendDebugMessage("Firmware Version: " + Winc15x0Interface.GetFirmwareVersion());

                sendDebugMessage($"WIFI Enabled, broadcasting on ssid {ssid}");
                if (wifiNetSettings.Mode == WiFiMode.Station)

                    var networks = Winc15x0Interface.Scan();
                    sendDebugMessage("Available Networks: ");
                    foreach (var network in networks)

            catch (Exception e)
                sendDebugMessage($"Initialization Failed");
                return false;

            return true; 

Why did you pull the en pin to low here? try to remove that.

Remove these, try one thing at the time, please

sendDebugMessage("Firmware Version: " + Winc15x0Interface.GetFirmwareVersion());


var networks = Winc15x0Interface.Scan();

I am not sure but you are in AP mode.

try this:

var interrupt = GpioController.GetDefault().OpenPin(SPI_INT);
var reset = GpioController.GetDefault().OpenPin(RESET);
var cs = GpioController.GetDefault().OpenPin(SPI_CS);

SpiNetworkCommunicationInterfaceSettings networkCommunicationInterfaceSettings = new SpiNetworkCommunicationInterfaceSettings();
var settings = new GHIElectronics.TinyCLR.Devices.Spi.SpiConnectionSettings()
	ChipSelectLine = cs,
	ClockFrequency = 2000000,
	Mode = GHIElectronics.TinyCLR.Devices.Spi.SpiMode.Mode0,
	ChipSelectType = GHIElectronics.TinyCLR.Devices.Spi.SpiChipSelectType.Gpio,
	ChipSelectHoldTime = TimeSpan.FromTicks(10),
	ChipSelectSetupTime = TimeSpan.FromTicks(10)

networkCommunicationInterfaceSettings.SpiApiName = SPI_API_NAME;
networkCommunicationInterfaceSettings.GpioApiName = GPIO_API_NAME;
networkCommunicationInterfaceSettings.SpiSettings = settings;
networkCommunicationInterfaceSettings.InterruptPin = interrupt;
networkCommunicationInterfaceSettings.InterruptEdge = GpioPinEdge.FallingEdge;
networkCommunicationInterfaceSettings.InterruptDriveMode = GpioPinDriveMode.InputPullUp;
networkCommunicationInterfaceSettings.ResetPin = reset;
networkCommunicationInterfaceSettings.ResetActiveState = GpioPinValue.Low;

WiFiNetworkInterfaceSettings networkInterfaceSetting = new WiFiNetworkInterfaceSettings()

	Ssid = "SITCore2601",
	Password = "0123456789",
	Mode = WiFiMode.AccessPoint,
	Channel = 6


networkInterfaceSetting.AccessPointClientConnectionChanged += NetworkInterfaceSetting_AccessPointClientLinkConnectedChanged;

networkInterfaceSetting.Address = new IPAddress(new byte[] { 192, 168, 0, 201 });
networkInterfaceSetting.SubnetMask = new IPAddress(new byte[] { 255, 255, 255, 0 });
networkInterfaceSetting.GatewayAddress = new IPAddress(new byte[] { 192, 168, 0, 1 });
networkInterfaceSetting.DnsAddresses = new IPAddress[] { new IPAddress(new byte[] { 75, 75, 75, 75 }), new IPAddress(new byte[] { 75, 75, 75, 76 }) };

networkInterfaceSetting.DhcpEnable = true;
networkInterfaceSetting.DynamicDnsEnable = true;

networkController.NetworkAddressChanged += NetworkController_NetworkAddressChanged;
networkController.NetworkLinkConnectedChanged += NetworkController_NetworkLinkConnectedChanged;


Thread.sleep(-1); // wait for event

Do I need to initialize in its own separate thread? this isn’t necessary for ethernet, but will I have to for wifi?

That just wait for connect event, don’t run anything next, make sure it is simple and work first.

After it work, you can add or modify anything you want.

Right now as I see:

  • Pull the EN pin to low while the module is active is not good. Just need to low → high once when the module reset or enter sleep mode.
  • WiFi.Scan(): I am not sure but this is for client mode, the module may switch to client mode automatically, no more AP mode.
  • You need AP address: Here I set to, your phone should be

The Winc15x0Interface()… may cause issue if called after enable(). I remember we fixed this issue but as recommend, try use before enable().

I mean if your phone set to DHCP. You can set static to “” but tried as my code first, it just worked on mine, then you can modify, of course.

  • WiFi.Scan(): I am not sure but this is for client mode, the module may switch to client mode automatically, no more AP mode.

It only does this if it’s in client mode, otherwise it skips it.

I moved things around as you suggest, added an IP address and it will initialize and respond, and network will appear. However, DHCP still isn’t working right, and it still fails to register a connection when I set my IP to static and connect directly - so in effect, nothing has changed.

I also noticed that the network only appears if I have no security on it, as soon as I add a password it is hidden and I can’t access it, either through the wifi manager or by manually adding the network.

However, the firmware version is The documentation says that anything 19.5.4 or greater should work, but I’m wondering if this is the culprit here. I’ll try to roll the firmware back to 19.5.4 and see if that changes anything.

Does connect event raise yet?





If I statically set my IP, my phone reports that it is connected to the network, but the event is not raised on the module and it cannot communicate over the network. If I set my phone to DHCP, I cannot connect at all, and Android reports that it failed to get an IP address. My laptop just tells me that it “Can’t connect to the network.” with DHCP enabled.

I will get the firmware updated when I can, I would imagine that it’s probably what’s causing issues. It’s weird to me that electrically everything is working and some features work and some don’t.

I have confirmed that the issue lies with the firmware. When used with a module with the correct firmware (19.5.4), it works perfectly.

I must ask though, as 19.5.4 is being phased out by major suppliers, are there plans to support later versions?

The best three words ever!

We will notice in doc. Thanks for your time on this.

1 Like