login

Author Topic: An Ethernet library for the W5100  (Read 7431 times)

0 Members and 1 Guest are viewing this topic.

An Ethernet library for the W5100
« on: March 22, 2012, 12:11:26 PM »
Hello :)

For my work I acquired a WIZ812MJ Ethernet module from Saelig, which I'm using with my breadboarded Wiring over an ATmega644(P). Given the absence in Wiring of a library for this module, I went on to look for an existing one, and eventually found this: http://www.mcqn.com/weblog/dhcp_and_dns_arduino, upon which I built the library I'm attaching (A little contribution payback from the Arduino community  8)). I had to make some minor modifications to the code, as well as adding the proper specification for the (SPI) Slave Select signal of my ATmega644.

The library implements DHCP and DNS, and serves both as Client and Server. The heart of the module, which is the specific target of the library, is the W5100 Ethernet Controller, the same used for the Arduino Ethernet shield. So in principle you could attach the shield to your Wiring board, but then you may have to modify the w5100.h file (line 323 and on) in the library to make sure the Slave Select signal is properly assigned to the pin where the shield expects to find that signal.

The connections I have to the module are: MOSI, MISO, SCK and SS as drawn on the ATmega644 datasheet. It is optional to add an IO pin to the reset signal of the module, but it is recommended for critical applications.

I hope the community finds this useful.
« Last Edit: March 22, 2012, 12:24:54 PM by lulingar »

barragan

Re: An Ethernet library for the W5100
« Reply #1 on: March 23, 2012, 12:52:01 PM »
hi, Fantastic!, thanks for the contribution, could you add it to the wiki? wiki.wiring.co

bhagman

Re: An Ethernet library for the W5100
« Reply #2 on: March 23, 2012, 12:54:03 PM »
Simply awesome!  Thanks!

I'm going to try it out this weekend.

Re: An Ethernet library for the W5100
« Reply #3 on: March 23, 2012, 02:24:17 PM »
Hi! Glad to contribute! Where precisely should I place this within the Wiki?

bhagman

Re: An Ethernet library for the W5100
« Reply #4 on: March 23, 2012, 05:41:57 PM »
I assume that the library has been written with Atmel "AVRisms".  I know it's tough to break away from it - eventually we can use the Wiring Framework functions to abstract the functionality to multiple processors.

I'm thinking http://wiki.wiring.co/wiki/Ethernet_Library

That looks like a good place.

bhagman

Re: An Ethernet library for the W5100
« Reply #5 on: March 25, 2012, 01:39:46 AM »
Bah.  Broken for me.  I don't have much time to look at it.

But first thing I see with the "WebClient" example is that there are several ARP requests for .1 on the network - then it dies.  I'm using WireShark to sniff the data.

---
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
Who has 192.168.0.1?  Tell 192.168.0.177
---

---
connecting...
connection failed

disconnecting.
---

I'll look more tomorrow.