Pages: 1 [2]   Go Down
Author Topic: Arduino with onboard Ethernet adapter: Still under development?  (Read 2765 times)
0 Members and 1 Guest are viewing this topic.
Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4575
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.    :-(

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

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

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4575
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...  smiley-cool

Logged

No, I don't answer questions sent in private messages...

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1481
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4575
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...?


Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4575
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...  smiley-eek

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.

« Last Edit: September 10, 2011, 06:18:39 pm by fungus » Logged

No, I don't answer questions sent in private messages...

0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1481
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 10, 2011, 06:25:47 pm by fat16lib » Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4575
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Code:
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!


Logged

No, I don't answer questions sent in private messages...

Pages: 1 [2]   Go Up
Jump to: