Pages: [1]   Go Down
Author Topic: Arduino + enc28j60 and TCP/IP  (Read 5748 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Hello,

Let me introduce yet another simple TCP/IP implementation. It cooperate with enc28j60 Ethernet chip. Attached example with simple www server implementation takes 6930 bytes for code and 224 bytes for ram.

At this moment it's not validating received packets checksum, but i think we can live without it ;]

https://sites.google.com/site/arianitblog/files/network.zip?attredirects=0&d=1

Please edit beginning of make.bat file in order to compile it ;]
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice.

But can we standardize the Ethernet library and add the enc28j60 driver?

I would think a better thing to do is take the Ethernet lib in arduino, use that as a interface, split out the wiznet 5100 calls(they are hardcoded), separate the drivers, and be more generic.   That way if one day yet another ethernet chip appears it can be added without too much pain.

Cause as it stands now, I cant use the snmp lib because its written against Ethernet lib, and that doesn't support the pic ethernet.....

Thanks for letting me vent in your thread.  I know its rude, I'm sorry.
I'll look at your code, cause I plan on doing just what I said, even tho its a big project.

Logged

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


Initially I was thinking about the same thing - make it compatible with Ethernet library. And as you can see, top level methods are very similar.

You could also check enc28j60 driver files where i made some functions which aim was to make it at all possible to achieve compatibility with Ethernet library.

However, for me the most important thing was to make it work with the least space taken and to provide simple interface with basic functionality.

It's good starting point to make it compatible with Ethernet library for anyone who would have time for it smiley-wink
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will definitely get it and look at it then.

Another plus is if for some reason you have to change hardware.  I always hate having to go back and recode wholesale sections.  

Which is why I modded the LCDI2C to use the same calls as LiquidChrystal, that was far easier than recoding the whole application that used it.  Reminds me I need to post those mods too...

Thanks in advance.
Logged

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

Hello, i make some upgrades for the previously released code:

- validating received packets checksum (it's done on the enc28j60 chip so it can handle large packets too)

- 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 smiley-wink







It comes along with much more advanced example:











You can download example code from here:

https://sites.google.com/site/arianitblog/files/network_v1.1.zip?attredirects=0&d=1

« Last Edit: December 17, 2010, 08:27:33 am by arian » Logged

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

I trying to test your code but i have some trouble to get the make file to work.
I have made changes to the "make file"
See:
Quote
set arduino_sketch_path=H:\Users\HP\Documents\Arduino\network1
set arduino_external_libs=?? what should i write here??
if "%arduino_sketch_path%" == "" set arduino_sketch_path=%CD%
set arduino_ide_path=H:\Users\HP\Desktop\arduino-0021
set arduino_ide_version=21
set arduino_core_path=%arduino_ide_path%\hardware\arduino\cores\arduino
Logged

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


For this code you can leave it empty smiley-wink It's for Arduino libs. For example if you want to use spi and wire lib, you could set it similar to this:

set arduino_external_libs=SPI Wire

Then it will try to compile library in the fallowing directories from Arduino IDE:

libraries\SPI
libraries\Wire
Logged

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

A ok  smiley
But i dont get it to work. (i dont know how i should work :o )
Should i get a .pde file if it´s works?
 
Looks like this  when i run the .bat file:
Code:
Linking all

H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-ar: .\build\Arduino\
network1.a: No such file or directory
avr-gcc: .\build\Arduino\network1.a: No such file or directory
H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-objcopy: '.\build\Ar
duino\network1.elf': No such file
H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-objcopy: '.\build\Ar
duino\network1.elf': No such file
All done.


Linking all

H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-ar: .\build\Arduino\
network1.a: No such file or directory
avr-gcc: .\build\Arduino\network1.a: No such file or directory
H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-objcopy: '.\build\Ar
duino\network1.elf': No such file
H:\Users\HP\Desktop\arduino-0021\hardware\tools\avr\bin\avr-objcopy: '.\build\Ar
duino\network1.elf': No such file
All done.

Some error with  "network1.elf"

Edit:
 I get it to work now, hade type something wrong i the .bat file.

This looks really god!  smiley
Great work arian !!

Now i gone try out this lib =)
« Last Edit: January 02, 2011, 01:53:12 pm by Fluke » Logged

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


Thanks smiley-wink

One tip about improving stability for the enc28j60. That chip can take up to 180mA, so if you are using USB as a power supply you have to change settings on Ardiuno's ft232 chip via "FT Prog".

By default, Arduino can take up to 90mA from USB smiley-wink
Logged

Pages: [1]   Go Up
Jump to: