Pages: [1]   Go Down
Author Topic: Achieving Ethernet top speed  (Read 737 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I would like to know what is the top speed achievable with the Ethernet Shield?

I have been trying to speed up my ethernet download speed, but i have been having problems with that.
I´m always trying to empty the W5100 buffer, but i don´t think that is the best way to make a download, because it might interfere with the filling of the buffer.

Does anyone has any ideas that can help.
Or code i can use as example, that allows for good download speeds? I have read that some people were able to achieve 14KB/s.

Regards
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The limit is the SPI bus speed.
Quote
I´m always trying to empty the W5100 buffer, but i don´t think that is the best way to make a download, because it might interfere with the filling of the buffer.
That is the best way. Until the buffer is empty, you can't get another packet, so the faster you empty it, the sooner you start getting another packet.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So,

Calling:

Code:
void SPIClass::setClockDivider(uint8_t rate)
{
  SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK);
  SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK);
}

and using:

Code:
#define SPI_CLOCK_DIV2 0x04

should allow me to achieve the highest speed, correct?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure about all that. The standard SPI library says this is the fastest:
Code:
SPI.setClockDivider(SPI_CLOCK_DIV2);
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yap,

It seems to work.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

8 MHz, that's the fastest you can get with SPI.
Can you deal with the data coming in that fast? Can't do much with it, any processing will take away from clock cycles for emptying the buffer.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes,

You are correct, right now my bottleneck isn´t the ethernet speed.
It´s the time i take to put the data in the SDCard...
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The SD card is also SPI, so the same limits apply there. Plus it takes a bit of time to buffer the SD for read/write. And you must share that bus with the w5100 and the SD card. What did you expect from a 16MHz computer?
Logged

Offline Offline
Sr. Member
****
Karma: 7
Posts: 275
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For the same or even lower price than an Arduino UNO or Leonardo with an Ethernet Shield you can get a Teensy3 and connect it to a WIZ820oo Ethernet module and get vastly improved throughput.

With the Teensy3 based on a 32 bit Arm Cortex M4 processor running up to 96MHz you have plenty of processing power left.

Can look linke this http://forum.pjrc.com/threads/23904-teensy3-WIZ820io-adapter-And-then-some?highlight=Frankie
Logged


Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SurferTim,

I wasn´t expecting nothing, i was only trying to achieve the highest speed i could and make my code as efficient as possible.

I´m now able to have a good enough speed for my application, i´m able to download a 130kB file and save it on the SDCard in aproximately 30/40 seconds.
Logged

Pages: [1]   Go Up
Jump to: