Pages: [1] 2 3 ... 7   Go Down
Author Topic: Implementation for Microchip ENC28J60 Ethernet controller  (Read 34908 times)
0 Members and 1 Guest are viewing this topic.
Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello guys,
I have one "etherShield" (an Ethernet shield that uses the Microchip ENC28J60 controller) and it does not work with the standard Arduino Ethernet library. It works with the etherShield library (http://www.nuelectronics.com/estore/?p=12) but is very very painful to write code for it (we need to implement ARP and TCP actions in the "application" layer - you can see examples in http://www.nuelectronics.com/download/projects/etherShield.zip).
The good news is that Microchip ENC28J60 is cheaper than WIZnet W5100. So I decided to write a new library (for now it's called Ethernet_ENC28J60) compatible with Arduino Ethernet examples, Ethernet.cpp, Server.cpp and Client.cpp - to do it I'm writing a socket layer that exposes the same API the standard Ethernet library does.
For now I can create a TCP server with some limitations -- but it works! :-) I modified the WebServer example to make it more simple and actually I can complete a HTTP request successfully.

I'm planning to turn it fully-compatible with Arduino Ethernet shield library and want to know if we can merge this code in the Ethernet library when it is done -- so we can support both controllers, with the same code (maybe adding "#define ENC28J60" to application's code so the Ethernet library can switch between the "card driver").

The code is available at GitHub (https://github.com/turicas/Ethernet_ENC28J60) -- please read the README to know about architecture and other things.
If you want to test, put Ethernet_ENC28J60 at ~/sketchbook/libraries and run the WebServerSimple example (https://github.com/turicas/Ethernet_ENC28J60/blob/master/examples/WebServerSimple/WebServerSimple.pde). I also created an example that controls a LED using the Web interface (available at https://github.com/turicas/Ethernet_ENC28J60/blob/master/examples/WebServerSimpleLED/WebServerSimpleLED.pde).
Please let me know your opinion!

Note: I posted an email about this in the developers mail list but as it wasn't answered, I'm posting here. What is the best place to this kind of topic?

Thanks.
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

Offline Offline
Edison Member
*
Karma: 23
Posts: 1375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds great!
Might use it in a future project that I have been delaying because of this (expensive wiznet and bad support for the enc28j60).
I'm now watching the project @github (awesome code sharing platform by the way) to be up-to-date.

One question, which are the differences between the ethernet and fullstack repos at github?

Keep up the good work!
Logged

Mercadillo electrónico. Kit iniciación a Arduino, shield LCD a color y más cosas!

Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Might use it in a future project that I have been delaying because of this (expensive wiznet and bad support for the enc28j60).
I'm now watching the project @github (awesome code sharing platform by the way) to be up-to-date.

Very nice! :-)

One question, which are the differences between the ethernet and fullstack repos at github?

Please ignore FullStack - I started with this project trying to change Ethernet.cpp, Server.cpp and Client.cpp but I decided to rewrite only socket.c instead of all those files. Rewriting just socket.c may be more painful but it'll more easy to maintain compatility with Arduino Ethernet Library, write "drivers" for other controllers and also improving the actual Ethernet library.
I'll delete the FullStack repository in a near future.

If you can, please try the examples I sent to the repository and send news about it! Now working on connect().
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

Offline Offline
Edison Member
*
Karma: 23
Posts: 1375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have a board to test it, but I am now more interested in getting one
Logged

Mercadillo electrónico. Kit iniciación a Arduino, shield LCD a color y más cosas!

Seattle, WA
Offline Offline
God Member
*****
Karma: 11
Posts: 673
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So I decided to write a new library (for now it's called Ethernet_ENC28J60) compatible with Arduino Ethernet examples, Ethernet.cpp, Server.cpp and Client.cpp - to do it I'm writing a socket layer that exposes the same API the standard Ethernet library does.

Very nice!  Happy to hear it.  Bringing up my ENC28J60 is my next project, so I will definitely check this out.  I mostly need a client, so maybe I can pitch in for your efforts smiley

As to getting it in as an official library, definitely finish it first.  Then the code can be reviewed and really proposed.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

what about this instructable. He claims, that you can use the Arduino-Ethernet-library. I didn´t test it so far.
http://www.instructables.com/id/A-credit-card-sized-Ethernet-Arduino-compatable-co/
Logged

Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

what about this instructable. He claims, that you can use the Arduino-Ethernet-library. I didn´t test it so far.
http://www.instructables.com/id/A-credit-card-sized-Ethernet-Arduino-compatable-co/

Hello,
it uses the code from etherShield I mentioned above. "etherShiled" is different from "Ethernet shield" - "etherShield" refers to code (for ENC28J60 controller) that is hard to use and is not present on Arduino IDE; "Ethernet shield" refers to standard Arduino Ethernet shield and code (for controller W5100). If you download the .pde file he attached to the instructable you'll see that this code does not use the Arduino standard Ethernet library.
What I'm trying to do is to create a Arduino Ethernet-compatible library that works with both controllers (so you can use the same code for both).
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

This is perfect timing. I have a board and are about to start writing a skecth for it.

I would like very much to have support for DHCP and DNS

Best regards
Logged

Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is perfect timing. I have a board and are about to start writing a skecth for it.

I would like very much to have support for DHCP and DNS

Hello Wolle,
firstly I'm trying to finish the socket layer (implementing part of TCP and UDP stacks). In the future I can work in another protocols (such DHCP, DNS etc.), but first I need to finish socket layer. :-)
If you can use the library, please give me your feedback.
Thanks.
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Compiling gives me errors ?

arduino-0022\libraries\turicasEthernet\utility\socket.c: In function 'connect':
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: 'destinationPort' redeclared as different kind of symbol
arduino-0022\libraries\turicasEthernet\utility\socket.c:189: error: previous definition of 'destinationPort' was here
arduino-0022\libraries\turicasEthernet\utility\socket.c:210: error: redeclaration of 'sourcePort' with no linkage
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: previous declaration of 'sourcePort' was here
arduino-0022\libraries\turicasEthernet\utility\socket.c:211: error: redeclaration of 'destinationPort' with no linkage
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: previous declaration of 'destinationPort' was here
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Tinkering in free time
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi alvarojusten,

This is fantastic news !

I am sure there are lots of people out there who are eagerly waiting your library. I just wanted to send you encouragement !!!

Cheers from Sg,
Keff
Logged

Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Compiling gives me errors ?

arduino-0022\libraries\turicasEthernet\utility\socket.c: In function 'connect':
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: 'destinationPort' redeclared as different kind of symbol
arduino-0022\libraries\turicasEthernet\utility\socket.c:189: error: previous definition of 'destinationPort' was here
arduino-0022\libraries\turicasEthernet\utility\socket.c:210: error: redeclaration of 'sourcePort' with no linkage
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: previous declaration of 'sourcePort' was here
arduino-0022\libraries\turicasEthernet\utility\socket.c:211: error: redeclaration of 'destinationPort' with no linkage
arduino-0022\libraries\turicasEthernet\utility\socket.c:190: error: previous declaration of 'destinationPort' was here

Hello Enn40,
excuse me for that - I pushed a code that I didn't compile to verify syntax problems (it'll not happen again). Please download the library again and try it: the last commit I did to repository is working fine (maybe you can experience some bugs if you enable debugging, but the normal usage of the library is OK now).

Hi alvarojusten,

This is fantastic news !

I am sure there are lots of people out there who are eagerly waiting your library. I just wanted to send you encouragement !!!

Hello Keff,
thanks! It'll be nice if you have an etherShield, test the library and give me more feedback.
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks ,

Web server simple led example gives me:

/arduino-0022/arduino-0022/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: WebServerSimpleLED.cpp.o: No such file: No such file or directory

Enn
Logged

Rio de Janeiro, Brazil
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
Software developer, free software activist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Web server simple led example gives me:

/arduino-0022/arduino-0022/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: WebServerSimpleLED.cpp.o: No such file: No such file or directory

Sorry, I don't use Windows and don't know how to add customized libraries. What I can suggest is to move the Ethernet_ENC28J60 folder from sketchbook/libraries to the libraries folder in the Arduino installation path.

Sometimes the Arduino IDE gives me some errors about paths but I just need to recompile and it works fine -- maybe it could be your case too.
Logged

Blog pt_BR: http://blog.justen.eng.br/
Curso de Arduino (Arduino Course, in Brazil) - http://www.CursoDeArduino.com.br/

Seattle, WA
Offline Offline
God Member
*****
Karma: 11
Posts: 673
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I just pulled this, and compiled the examples, and they all compiled without any complaints.  This is on OSX.
Logged


Pages: [1] 2 3 ... 7   Go Up
Jump to: