Main Site Documentation

W5100 sample code


Hi, we have hooked up a W5100 device to our panda, but we are struggling to find any simple sample code to use the new WIZnet_W5100 assembly, most of the code seems to be referring to a previous beta, is there an up to date example on how to use the GHIElectronics.NETMF.Net.WIZnet_W5100 class,


for example most of the code has this call…

WIZnet_W5100.Enable( SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10,

but there seems to be an extra parameter on the Enable call in the assembly

public static void Enable(
	SPI_module spi,
	Pin CS,
	Pin Reset,
	bool ReserveSocket


I notice this thread is on the same issue

we see the same problem, any thoughts

    #### Exception System.Exception - 0x00000000 (1) ####
    #### Message: Fail[invalid ip,port]


There are four sockets on the w5100. If you will be using dns, then you need to reserve a socket for it’s use.

The first betas automatically had a socket reserved, giving the user three sockets to use.

If you were building a server, which did not use dns, the fourth socket was unavailable.

The reserve parameter was added at the end of the beta to give the user the option to control the reservation of the fourth socket. Now, you can accept four sessions on a server.


Basically what Mike had said…

ReserveSocket was added after beta so all you had to do to use old code is to add a last parameter of true or false. If not sure what that is, use true.


OK got it sorted, the trouble was with the cs for reference you need to wire up the following pins on the WIZ5100…





now works well, good job monkeys (Joe)


Ethernet shield brochure and GHI NETMF library documentation have some examples too.


I’m using this DFRobot ethernet shield (W5100 chip) with my Panda.
The first example (simple web server) from the Ethernet brochure works just fine within the local network ( static IP, port forwarding from my router). I’m not able to connect to the web server using the address
The same setup works with Arduino, but not with Panda. It just lights up the communication LED’s 3 times, then I get a server is taking too long to respond message.
Please help, I’m not familiar with sockets… what debug messages should I use to see what’s happening?

Thank you!


you don’t need debug messages, you need network monitor. Download it from and install it on a PC. Then capture what traffic is being sent to the device from your internet facing device.

Personally I always suspect port forwarding setups :slight_smile:


Thank you, Brett, but I’m afraid that I don’t understand much from the output :frowning:

A few output lines (IP edited by my where xxx.yyy). PC address is, Ethernet shield on Panda is, router is

[quote]3 14:30:40 02.12.2010 8.3925780 chrome.exe TCP TCP:Flags=…S., SrcPort=2810, DstPort=HTTP Alternate(8080), PayloadLen=0, Seq=2274523199, Ack=0, Win=65535 ( Negotiating scale factor 0x1 ) = 65535 {TCP:1, IPv4:1}

4 14:30:40 02.12.2010 8.3925780 ARP ARP:Request, asks for

5 14:30:40 02.12.2010 8.4228510 chrome.exe TCP TCP:Flags=…S., SrcPort=2811, DstPort=HTTP Alternate(8080), PayloadLen=0, Seq=758498030, Ack=0, Win=65535 ( Negotiating scale factor 0x1 ) = 65535 {TCP:2, IPv4:1}

6 14:30:40 02.12.2010 8.6435540 chrome.exe TCP TCP:Flags=…S., SrcPort=2812, DstPort=HTTP Alternate(8080), PayloadLen=0, Seq=3819894829, Ack=0, Win=65535 ( Negotiating scale factor 0x1 ) = 65535 {TCP:3, IPv4:1}

7 14:30:41 02.12.2010 9.3984370 ARP ARP:Request, asks for

8 14:30:42 02.12.2010 10.4033200 ARP ARP:Request, asks for
and so on, 3 or 4 times…


You will need to filter out all other traffic and leave Panda traffic only. That will make things easier to look at. I haven’t used Network Monitor, but in Wireshark you can do filter by IP. There should be something similar in Network Monitor.


The problem was that I didn’t changed the MAC.
I still don’t know why it only worked with, but now it works with both addresses (192.168… and 188.26…)
Maybe there’s a obvious reason, I don’t know much about networking, still have a lot to learn…

//        byte[] mac = { 43, 185, 44, 2, 206, 127 };
        byte[] mac = { 222, 173, 190, 239, 254, 237 }; // the mac that worked with Arduino

Thank you Brett and Architect for your help!


[quote]OK got it sorted, the trouble was with the cs for reference you need to wire up the following pins on the WIZ5100…




I got the same message as Peter Kenyon:
Additional information: Fail[invalid ip,port]

What should i wire up?? I don’t see the indicated pins on my arduino ethshield
Can you maybe post a pic of it??




It’s seem like you have the version 5 of the Ethernet Shield from Arduino…
Unfortunately, there are no traces from pin 11 (MOSI), 12 (MISO) and 13(CLK) on the Shield.
They want to have the compatibility to both Arduino & Arduino MEGA, so they moved the connection to the ICSP at the bottom of th uSD socket.

If you want to use the shield with FEZ (Domino or Panda) you need to rewire those SPI pins to

look at this thread before the end of page 1 and at the end of the post of the pictures of how I modified the Shield.


Hi Sam!

Ok, thanks for the quick reply. I’ll have a look at it.




I am waiting on one of these. Will use your wiring trick. Thank you.


Does anybody know, if the seeedstudio shield works without rewiring?


Look from the Schematic provided in the downloaded zip files.
I would say YES! No rewiring is needed! :wink:


Ok, thanks again Sam. We’ll give it a try!

Best regards,