Ethernet shield W5100 data transfer speed and capacity.

Hi, friends.

can Arduino Ethernet shield based on W5100 Chip is able to send 4 Byte data together on single go..?

TIA

Yes, but I would suggest getting the W5500 version.

Example code is attached i do not know how to send data by packeting. W5100 may have 8 bit data bus. so this will take too much time to transfer data. because data is 32 bit , 4 Byte.

Kindly suggest me the way.

ethernet_test_speed.ino (2.31 KB)

The interface between the Arduino and the W5100 is SPI, not a parallel data bus.
If you want to send raw data you'll want to use client.write()
https://www.arduino.cc/en/Reference/ClientWrite

Just a few days ago, I released version 2.0.0 of the Ethernet library. It features greatly improved performance. W5100 on Due can now transfer approx 100 kbytes/sec speed for TCP client connections, where 1.1.2 was limited to about ~10 kbytes/sec (and often the speed was much lower).

To get the new version, just click Sketch > Include Library > Manage Libraries, search for Ethernet, and click the Upgrade button. Or if the library manager shows the install button, select version 2.0.0 and install it.

I made 6 different levels of optimization in the version 2.0.0. Here's a blog article I wrote with details, and benchmark tests on 15 different boards (including Arduino Due).

https://www.pjrc.com/arduino-ethernet-library-2-0-0/

Almost everyone who has previously tried to speed up the Ethernet library has focused mostly on SPI. I did this too, but the other higher level optimizations are far more effective. They greatly reduce the amount of redundant SPI communication required for accessing registers rather than actual data.

About SPI.transfer(buffer, size) for W5100, if you look at w5100.cpp in version 2.0.0, you'll see a comment where I tried this but it didn't work on some boards. You'll see a "#if 1" in the code, where the block mode is disabled. Currently it's at line #393. If you edit this line to "#if 0", the 4 individual transfers will be replaced with a single block transfer. If you give this a try, I'd be curious to hear if there's any significant performance difference with your ethernet_test_speed.ino sketch?

If you scroll down near the end of that blog article, you'll see where I did 2 similar speed tests on 44 different board+shield combinations, including 3 different shields (with W5100, W5200, & W5500) used with Arduino Due.

As I tried to explain in the text, the "local" client test mostly depends on SPI performance. With a server on the same local LAN, packets have very low latency, so the W5100 limited buffer size rarely comes into play. As nearly as I can tell, your ethernet_test_speed.ino test is basically the same, except you're reading 1 byte at a time which is much less efficient that requesting a buffer to fill. Still, I tried very hard with 2.0.0 to optimize performance for these sorts of sketches that fetch 1 byte at a time.

The "google" test fetches a page over the internet. Even though Google has the world's best distributed hosting, packets still have substantial latency of many milliseconds. In that test, the ability to buffer packets matters. Faster SPI will give your program more time to do other work, but in the case of a program which merely waits for the data, the limited buffer size and packet latency ultimately limit the total speed.

Hopefully these new optimizations will help your application?

1 Like

Also, something to consider in your speed test is whether to write every byte to Serial.

    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);

This Serial.write(c) line will cause your measurement to test speed of Serial.write() as well as client.read(). On Due’s programming port at 9600 baud (as used in your program), this will limit the overall speed to no better than 960 bytes/sec, no matter how fast Ethernet really is.

I recommend not printing all the bytes to Serial. You might also try a faster baud rate…

1 Like