Hi Roschmi, Valon,
I tried both of your suggestions. Thank you Roschmi for your code. It is for Cobra, but I use panda, anyway, I got how to write code for static IP. Rest of the portion in that project is for Http so I left it. Please note these points,
a) I configured the EthernetENC28J60 object using following API
public EthernetENC28J60(SPI.SPI_module spi, Cpu.Pin chipSelect, Cpu.Pin externalInterrupt);
//
// Summary:
// Creates a new instance.
//
// Parameters:
// spi:
// The SPI module the device is wired to.
//
// chipSelect:
// The chip select the device is using.
//
// externalInterrupt:
// The external interrupt pin the device is using.
//
// reset:
// The reset pin the device is using.
public EthernetENC28J60(SPI.SPI_module spi, Cpu.Pin chipSelect, Cpu.Pin externalInterrupt, Cpu.Pin reset);
and I called as
ethernetJ11D = new GHI.Networking.EthernetENC28J60(Microsoft.SPOT.Hardware.SPI.SPI_module.SPI2, G120.P0_5, G120.P0_4, G120.P4_28);
based on my board.
I wrote the function in main() as below;
public static void Main()
{
Debug.Print(Resources.GetString(Resources.StringResources.String1));
blinkLED();
setEthernet();
}
public static void setEthernet()
{
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
netif = new GHI.Networking.EthernetENC28J60(Microsoft.SPOT.Hardware.SPI.SPI_module.SPI2, //Verified
FEZPandaIII.Gpio.D20,//This is Chip select, verified
FEZPandaIII.Gpio.D21,//This is for external interrupt, but not used
FEZPandaIII.Gpio.D25//Reset // not used
);
netif.Open();
// for static IP
netif.EnableStaticIP("192.168.1.23", "255.255.255.0", "192.168.1.1");
netif.EnableStaticDns(new[] { "192.168.1.1" });
while (!_hasAddress || !_available)
{
Debug.Print("Initializing");
Thread.Sleep(100);
}
}
Thing is that
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
Attaching my laptop’s IP address
The RJ45 light is not lighting…