Main Site Documentation

EthernetENC28J60.EnableStaticIP fails


#1

Dear friends,
I have designed a custom “shield” for a Panda III that hosts a Olimex ENC28J60 ethernet module (among other things)… Attaching a partial schematic, I hope. The module appears to Open all right but EnableStaticIP always fails with a generic “Exception was thrown: System.Exception.”

Here is my code…

using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Net.NetworkInformation;
using System;
using System.Net;
using System.Threading;

namespace MFConsoleApplication2
{
public class Program
{
private static EthernetENC28J60 Adapter;
public static void Main()
{
try
{
InputPort WOL = new InputPort(GHI.Pins.FEZPandaIII.Gpio.D4, false,Port.ResistorMode.Disabled);
Adapter = new EthernetENC28J60(GHI.Pins.FEZPandaIII.SpiBus.Spi1, GHI.Pins.FEZPandaIII.Gpio.D10, GHI.Pins.FEZPandaIII.Gpio.D9, GHI.Pins.FEZPandaIII.Gpio.D7);
Adapter.Open();
Adapter.EnableStaticIP(“192.168.0.25”, “255:255:255:0”, “192.168.0.1”);
}
catch (Exception E)
{

            }          
    }
}

}

A stack trace says,
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::IPAddressFromString
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::EnableStaticIP
GHI.Networking.BaseInterface::EnableStaticIP
MFConsoleApplication2.Program::Main

If this indicates that my IP address is formatted incorrectly, what’s wrong with it?
Suggestions welcome!
Thanks,
MRO


#2

you have colons in the subnet mask field. Should be an IP address, so 255.255.255.0


#3

No sooner than I had posted the question, I found the answer: “255:255:255:0” should be “255.255.255.0” D’uh!


#4

Thanks, Brett…