FEZ Cerberus with ENC28 Module on 4.3

Hi guys,

I’m trying to switch an old project from 4.2 framework to 4.3.
I need to initialize ENC28 with Static IP and then start a web server.
In 4.2 project I initialized the ENC28 and started Web server using this code:

With NetworkInterface.GetAllNetworkInterfaces()(0)
.EnableStaticIP("192.168.2.64", "255.255.255.0", "192.168.2.1")
.EnableStaticDns(New String() {"8.8.8.8"})
End With
WebServer.StartLocalServer("192.168.2.64", 80)

Now, in framework 4.3 the same code throws this exception on the row of WebServer.StartLocalServer function:

ErrorNumber: 10022
Message: Exception was thrown: System.Net.Sockets.SocketException
StackTrace:

[quote]Microsoft.SPOT.Net.SocketNative::bind
System.Net.Sockets.Socket::Bind
Gadgeteer.Networking.WebServerManager+Server::StartLocal
Gadgeteer.Networking.WebServerManager::StartServer
Gadgeteer.Networking.WebServer::StartLocalServer
AGITempStationNew.AGITempStationNew.Program::InitializeComponents
AGITempStationNew.AGITempStationNew.Program::ProgramStarted
AGITempStationNew.AGITempStationNew.Program::Main
[/quote]

Is changed the method for initialize the ENC28 module or it’s the same of 4.2 framework?

Thanks a lot
Big

@ BigFoot - How the FEZ Cerberus handles networking was brought in line with the rest of our products in the 4.3 SDK. https://www.ghielectronics.com/docs/30/networking discusses how to initialize the network now.

@ John - I read that document and I also tried this code:

Dim pEth As New GHI.Networking.EthernetENC28J60(Hardware.SPI.SPI_module.SPI1, Hardware.Cpu.Pin.GPIO_Pin7, Hardware.Cpu.Pin.GPIO_Pin8, Hardware.Cpu.Pin.GPIO_Pin9)
pEth.Open()
With pEth
   .EnableStaticIP("192.168.2.64", "255.255.255.0", "192.168.2.1")
   .EnableStaticDns(New String() {"8.8.8.8"})
End With

but the same exception is thrown.
Maybe are wrong the parameters of EthernetENC28J60 constructor?

@ BigFoot - You need to update the pins to match your hardware setup as the document talks about. If you are using Gadgeteer, just connect the ENC28 module in the designer and it will be taken care of for you.

@ John - In older versions of framework I remember that ENC28 module couldn’t be added in designer when using Fez Cerberus. Now is it possible?

@ BigFoot - That is correct, starting in 4.3.

@ John - I found the issue. I didn’t call the EthernetENC28’s function .UseThisNetworkInterface() .

Now I found another problem using WebServer.
Those are the steps I do:

  • Set EthernetENC28 using static ip address;
  • Start a web server on port 80;
  • Manage the web server’s default event using a WebEvent’s class instance.

When I request the default page from a browser I see in the Immediate Control Window that there is a thrown exception IndexOutOfRangeException from Gadgeteer.WebServer.dll:

[quote]Using mainboard GHI Electronics FEZ Cerberus version 1.3
IS OPEN : True
Web server started at http://192.168.2.64:80/
Program Started
Eccezione first-chance di tipo ‘System.IndexOutOfRangeException’ in Gadgeteer.WebServer.dll[/quote]

This exception is thrown each time I request the default page.

Here you can find a sample project (VS2012 - VB.NET) to reproduce this issue: http://www.filedropper.com/gadgeteerapptestenc2843
About hardware I’m using the lastest FEZ Cerberus firmware:

[quote]Loader (TinyBooter) version information:
4.3.4.0 on this computer.
4.3.4.0 on this device.

The Loader (TinyBooter) is up to date. <<<

Firmware (TinyCLR) version information:
4.3.6.0 on this computer.
4.3.6.0 on this device.

The Firmware (TinyCLR) is up to date. <<<[/quote]

What can I do?
Can you provide me a link with WebServer source code for debugging?

@ BigFoot - Regretfully it appears to be an issue with Gadgeteer: https://gadgeteer.codeplex.com/workitem/1861

Solved. Thanks to both!