The only lib that seems to be good is uIP port for AVR (GitHub - sde1000/NanodeUIP: Port of uIP library to Nanode) and it already has psocks libs which provides socket API.
But it does not work in some cases (f.e. when response is sent right after data is received) and it's pretty difficult to debug network packets (~10.000 lines without debugger).
I've spent almost 2 months trying to make it working and finally failed)
Any ideas how to get functionality similar to w5100 lib?
The next methods are required:
I tried the libraries as well, and indeed it if far from obvious. My HW is a DINo from KMtronic, and I managed to get the web server example (using an old, maybe modified Ethershield) running. Ethercard always failed, though it looks to be smarter and more optimized. I consider using the Nanode variant, did you try that one ?
Yes, i played with Nanode a week or two.
It is designed to reply to GET response once so i was unable to work with it as with stream (use write(int outComingByte) method)
Do you think it would be feasible to align the library API with the Wiz5100 one ? How complex would that be ? Because things like IPAddress class etc. should be the same, shouldn't they ?
tochinet:
Do you think it would be feasible to align the library API with the Wiz5100 one ? How complex would that be ? Because things like IPAddress class etc. should be the same, shouldn't they ?
I believe probably 30-40% of the differences are linked to "programming style" and naming conventions more than functionalities. Things like MAC addresses or SPI instructions could be the same. On the 28J60, there seems to be a buffer so that you can "push" the parts of the packet and then kind of "flush" it. Sounds close to Serial API, and WIZ5100 library was reworked in order to be closer to Serial IIRC ? (or maybe it's a very bad idea because the meaning of fluch is completely different ?)
On the other hand, the TCP part on both circuits seems very different, since 5100 can handle TCP itself while 28J60 can't (what in practice limits connections one received packet / socket).
Any idea which of EtherShield or EtherCard would be a better start ? Anybody wanting to collaborate on that ? The first step wouldn't include any programming, only collaborate to understand the differences... And why not, put the result somewhere in the playground.
tochinet:
Any idea which of EtherShield or EtherCard would be a better start ?
In the meaning of closest API psock is the closest, but it's very difficult to debug using Serial.print(..) only without hardware debugger.
Also take into account that psock is designed in a very complex way in the meaning of working with threads, so it's behaviour is pretty strange: it can go out of infinite loop in a thread and move back later.
So you have to understand psock threads idea first. I believe that with hardware debugger and/or deep knowledge of TCP it's much more easy.
Another approach can be to get one of existing tiny TCP implementation (f.e. lwIP http://savannah.nongnu.org/projects/lwip/) and port to ATMega/Arduino + Enc28j60 thought i'm not sure that it can be done as it works with hardware closely.
Anybody wanting to collaborate on that ? The first step wouldn't include any programming, only collaborate to understand the differences... And why not, put the result somewhere in the playground.
tochinet:
Any idea which of EtherShield or EtherCard would be a better start ? Anybody wanting to collaborate on that ? The first step wouldn't include any programming, only collaborate to understand the differences... And why not, put the result somewhere in the playground.
Why not turicas's? He seems to have already done most of the job. I haven't tried his work yet, though. Maybe I'll find some time to do it in the weekend. Oh, and I've found another one: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291904599/8. Quite rough and I can't get it to work, but has some good points:
write function can assembly one big packet from smaller chunks
buffer (1536bytes) for TCP/UDP data directly on enc28j60 chip. Thanks to this we can use "available" and "flush".
I think compatibility with Arduino Ethernet library is now within your reach Wink
BTW, I am currently using EtherCard on KmTronic's DINo with good results, anyway. @4ntoine: Are you sure your code is OK? With a 700-800 byte packet buffer it's quite easy to run out of RAM :(.
@4ntoine: Are you sure your code is OK? With a 700-800 byte packet buffer it's quite easy to run out of RAM :(.
This can probably be the reason. But i used libs examples to test if it's working in common case first so buffer size is used as is.
I try to modify StandardFirmata sketch to work over Ethernet (TCP) using enc28j60, so most part of the sketch seems to be mature and stable.
Firmata messages are quite short, no longer than 50 bytes (except one message).
I don't know whether you have noticed my posts about my Ethernet-library for ENC28J60. It wrapps the µIP-stack of Adam Dunkels does persisttent TCP, UCP, ICMP, DHCP and DNS and provides the same API as the stock Ethernet-lib for W5100: