Arduino with onboard Ethernet adapter: Still under development?

I've have an EtherTen and I've run the basic web server demo that comes with the Arduino IDE with no problems at all. Also tried out an SD card and wrote a file without problems either. Really nice board.

Thank you for mentioning the SD card slot, that is another very useful element. I think I will try the product.

Guys
I have just acquired the Freetronics EtherTen, looks like a great board and saves on a shield and throws in SD Storage and PoE. I intend for it to act as a data collector via a network of Xbees and the SD card would be ideal for the data storage. I have not used the SD card on Arduino before, can you please advise if there is a preferred library for the EtherTen to utilize the SD Card ?. Ideally the data format should be compatible with a PC, but not essential.
Thanks in advance

Not to worry, I have sorted my issues with the SD Card, just downloaded sdfatlib20110702 and all seems to be good so far.

I just acquired an EtherTen too, with much the same goal in mind. It's working well serving small html and svg files, but slows down markedly with larger files such as jpegs. Add in dynamic content such as plots of sensor data, and it's really struggling. It's fun to see what can be done with 32k and an 8-bit processor, but I think I'll switch to a small Atom-PC for data collection and web-serving.

Anyway, I recommend taking a look at the v1.0-beta IDE. The standard Ethernet and SD libraries are very much improved: the code is cleaner, easier to use, and includes features which previously required external libraries (eg. DHCP). The included examples are very easy to follow.

Thanks for the update tim7, I will check it out. Sounds like you are a bit ahead of me at the moment.

tim7:
... but slows down markedly with larger files such as jpegs.

I'm just writing a web server for an Ethernet Arduino and it seems very slow. It's currently sending files at about 30kbytes/sec.

I'm sure I can optimize a bit more but still, I think it will struggle to send much more than 50kbytes/sec. I know it's only an Arduino but I expected a little bit more...

Guys
I ma looking into the NetDuinoPlus to see if I can get a reasonable performance. It has built in Ethernet, SD memory card and a much faster processor.

@BC238 the Arduino Ethernet is in production and being sold for quite a bit now.
http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11_12&products_id=141

you can buy it with or without POE module in case you want to power it through the ethernet cable.

@fungus I think you need to be realistic about what can be done with an 8 bit processor with 2k of ram running at 16mhz.. i would say 30kb/s it's very impressive for such a simple device. if you want more power you might need to get a Linux single board computer.

@tdrew keep in mind that, apart from the shape and vague resemblance in the name, the netduino has got nothing to do with arduino: it's programmed in a different language (C#) and different IDE, different API etc... so you might need to re-learn everything you learned on arduino

m

Thanks M
Very much aware of the differences, I have been playing with it for a little while now. I have used some .net before, just seriously and not in this embedded micro world.
Still have a way to go though ....
Tim

Hello again...

I've done some more tests and I found that the fastest I could transmit data across a network connection from the Arduino is about 75kbyes/sec. I think my web server can be optimized a little bit more... :slight_smile:

To me it seemed that 200 clock cycles per byte sent is quite a lot so I looked in w5100.cpp and the loop to send data looks like this:

  for (int i=0; i<_len; i++)
  {
    setSS();    
    SPI.transfer(0xF0);
    SPI.transfer(_addr >> 8);
    SPI.transfer(_addr & 0xFF);
    _addr++;
    SPI.transfer(_buf[i]);
    resetSS();
  }

So it does a complete SPI transaction per byte ... there's the problem!

Can the w5100 not receive bytes sequentially?

I don't really need this to be a serious web server, I'm just experimenting. The main idea behind what I'm doing is to create a web server with extensions to view/control the Arduino pins directly. That way I can do things with the Arduino via a web browser (eg. my mobile phone) from anywhere in the world.

But ... it would be nice if it worked well as a little web server too, there's plenty of space on the SD card for files.

Sadly, the W5100 requires four byte on the SPI bus to transfer one data byte. Here is a quote from the datasheet.

In SPI Mode, W5100 operates in “unit of 32-bit stream”.
The unit of 32-bit stream is composed of 1 byte OP-Code Field, 2 bytes Address Field and 1 byte data Field.

There are two SPI op-codes, read and write.

fat16lib:
Sadly, the W5100 requires four byte on the SPI bus to transfer one data byte. Here is a quote from the datasheet.

Oh, well, there's not much to be done about it. :frowning:

75 kbytes/sec is the target speed then...!

I think I can get pretty close to that with a few more changes.

fungus:
75 kbytes/sec is the target speed then...!

With a bit more fiddling I got it up to about 50kbytes/sec ... that's about 2/3 of theoretical maximum speed.

Where's the rest? Well...50k bytes/sec is about 100 SD card sector reads. Each sector read takes a little over 3 ms so that's over 300 ms each second spent reading the SD card ... about 1/3 of the available time.

2/3 + 1/3 = 1

I guess I've hit the limit... 8)

I think the Enet library uses the default SPI clock of F_CPU/4 or 4 MHz with a 16 MHz CPU. The W5100 should work with a faster SPI clock.

You might be able to go faster with an 8 MHz SPI clock. You need to set the SP2X bit in SPSR.

If you are using the SD.h library, which is a wrapper for an old version of my SdFat library, it sets SPI clock to F_CPU/4 so don't set the SP2X bit until the SD library is initialized.

My new SdFat library sets the SPI speed each time it accesses the bus so you should initialize it at 8 MHz and the Enet will also run at 8 MHz.

fat16lib:
You might be able to go faster with an 8 MHz SPI clock. You need to set the SP2X bit in SPSR.

I just put "SPI.setClockDivider(SPI_CLOCK_DIV2);" in my setup() function and the speed went from 50kbytes/sec to 67 kbytes/sec - a pretty good gain.

What's the spec of the W5100? Is that speed within its tolerances? How about the SD card...?

PS: If you want to try it out you can click here: http://87.221.151.193/index.html

That page is currently being served by the Arduino (it's a mirror of my site at www.artlum.com).

nb. The IP address is dynamic so it will probably change as soon as I post this... :astonished:

There's a big image of David Cuartielles on there, click on the little picture of him about a third of the way down the Gameduino page. See how long it takes to load ... on the local network it takes about 30 seconds.

SD cards are 25 or 50 MHz depending on the card version.

The W5100 specs rise and hold times that imply about 10 MHz max.

The Arduino is 8 MHz max.

Note that setClockDivider may not always work since libraries set the SPI speed to anything they want and do not restore it.

I was just sitting here and I saw some activity on the Arduino server...

I looked at the HTTP headers on the server log and it says:

GET /robots.txt HTTP/1.1
Host: 87.221.151.193
Connection: Keep-alive
Accept: text/plain,text/html
From: googlebot(at)googlebot.com
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Accept-Encoding: gzip,deflate

GET /index.html HTTP/1.1
Host: 87.221.151.193
Connection: Keep-alive
Accept: */*
From: googlebot(at)googlebot.com
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Accept-Encoding: gzip,deflate

Looks like my Arduino just got visited by the Google bot!