Can anyone recommend me a good alternative Ethernet library

Can anyone recommend me a good Ethernet library to work with a simple home made ENC28J60 Ethernet module or this module: http://www.geeetech.com/Documents/ENC28J60%20Manual%20Source%20Code.pdf.
(Its great if there is a proper documentation with the library so I can easily understand it and modify the sketch for my requirement)

Default Arduino Ethernet library is not working with this module.

Please help…

For enc28j60 the best is https://github.com/jcw/ethercard

I tried the EtherCard Lib , and examples on it. But it isn't working. Seems this Lib is written to work with the EtherCard module, so should I do any modification to get it work with my ethernet module. And, is there any documentation for this EtherCard lib?? (because I need to understand the coding to modify it to cater my requirements )

Show me wiring - how you connected eth module to arduino. Then we will configure library correctly.

I used the same wiring as in the 2nd page of this pdf http://www.geeetech.com/Documents/ENC28J60%20Manual%20Source%20Code.pdf

(sorry I can't upload the image here. I tried but getting an error)

OK, so you should be able to use testDHCP example from etherCard library. The only change you have to do is change line 27 wich is

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)

to:

if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)

becouse by default this library is using pin 8 as ChipSelect and in your configuration it is pin 10.

After that, when you compile and upload project just run serial monitor and look on it. You should get information what ip addres arduino got.

Of course to make this example work you need switch or router with DHCP configured. Do you have one? What does your network looks like? Where ethernet module is plugged in?

I only have a single port router. I'm testing these using a cross cable directly to my laptop (Win7).. can this cause problems?.. I cannot try the example you gave me as im not using the router,can i?.. If so tell me a way to do this with my same setting(direct connection to laptop)

And again, Thanx alot for helping me..

If you are using crossover cable, then you need to use example with static IP, eg. "getStaticIP", but it also needs modification. Change ether.begin() as previously (add third parameter "10") and set correct ip addresses. What is your computer network setting? Are you getting ip from router or it is set manually? Show me those values.

And I'll try to modify that line and run that example. My router is DHCP enabled.

And, as you said in this lib CS configured to as pin 8, so if I change my wiring and connect CS to pin 8, not to pin 10, should the other examples also work?

My computer network settings are IP: 192.168.1.2 Subnet mask: 255.255.255.0 default gatway 192.168.1.1 DNS: 192.168.1.1

I had this set to obtain IP automatically, but I changed it to this setting to connect my ethernet device. But I always change the IP in sketches to a suitable range when I try static IP examples.

Hey I tried testDHCP example as you said, it worked.. I could get the info. Thanx alot.. Now Im gonna try other examples too..

Is it ok if do not change the code, but change the CS from pin10 to Pin8 ?

And is there any documentation for this lib. because i need to do modifications to get what i really want to happen..

Thanx alot again.. It was a great help

Is it ok if do not change the code, but change the CS from pin10 to Pin8 Yes, you can.

And about documentation... library is very simple and all you need is to play a little with examples. Everything is there... really :)

Ya it worked..it totally works... It was a great help.. thanx alot..

I am glad that I could help :slight_smile:

direk: For enc28j60 the best is https://github.com/jcw/ethercard

So yes, this is a fact, EtherCard is the best for Arduino right now. That said, I am starting to hack on uIP, too. uIP has the potential to be even better because it is the most mature microcontroller TCP/IP stack. The best implementation of uIP for Arduino I've found is NanodeUIP, so I took a fork of it on github maniacbug/NanodeUIP. There is a pachube example, telnet server, and a server for an example custom TCP/IP protocol. While designed for Nanode, my fork works with regular shields too.

Hithere maniacbug, i search for something and you name apears ;) i'm trying to use the telnetserver demo here "maniacbug/NanodeUIP", but i get the message "shell.cpp:35:21: error: Arduino.h: No such file or directory"

is this ready for working in regular arduino or do i need nanode ?

regards

EDIT:only happens with ide22 with 1.0 compiles ok..

fca:
Hithere maniacbug, i search for something and you name apears :wink:

Haha… We have overlapping interests, clearly.

fca:
is this ready for working in regular arduino or do i need nanode ?

Works great on non-nanode. However, you have to make a couple changes. First, remove the #include <NanodeUNIO.h>. Second, consider this code from the pachube example:

#if 0  // Nanode
  byte macaddr[6];
  NanodeUNIO unio(NANODE_MAC_DEVICE);
  unio.read(macaddr,NANODE_MAC_ADDRESS,6);
  uip.init(macaddr);
#endif
#if 1 // EtherShield
  byte macaddr[6] = { 0x2, 0x00, 0x00, 0x1, 0x2, 0x3 }; 
  uip.init(macaddr,SS);
#endif

The first batch are the things that are nanode specific, and the second batch are the replacement calls for EtherShield, or any card with chip-select on 10.

In fact, I am running this on 1284P in another window as I write this… :grin:

fca:
EDIT:only happens with ide22 with 1.0 compiles ok…

Yes, you nailed it. I never bothered to test it under 0022. If you want to test it on 0022, I can make the changes.

no need for 022 for now i’m testing some enc28j60 boards… but the telnet server is heavyyyyyyyy even cheap i think that wiz5100 with the tcpipstack by hw will be better…
i wanted cheap solution that i can connect by a telnet connection and see what is being received by the rf24+

instead of printing to serial port i would like to have something like telnetd.print("receivedinfo)…

Bu my base arduino after all my code and pachube with the wiz5100 is only with 400bytes free so if i go with the en28j60 no go with the atm328p… :frowning:

thanks

fca: i think that wiz5100 with the tcpipstack by hw will be better...

Oh yes, the wiz5100 with tcp/ip in hardware is better, no question. The enc28j60 is only for us cheap hardware junkies :% The trade off is software complexity.

Though if you want simple yet still use enc28j60, try EtherCard as mentioned earlier in this thread.

Bu my base arduino after all my code and pachube with the wiz5100 is only with 400bytes free so if i go with the en28j60 no go with the atm328p.... :(

Yeah, the only hope would be if you have static strings or data hanging around in RAM that could be optimized out.

That said, what ELSE is taking RAM? RF24 takes 16 bytes of RAM, so you must have some serious buffers or something being used by your program logic?