DUE ethernet performance on W5200 with SPI and SPI+DMA

Most of the older Ethernet shields have the wiznet w5100 chip. I have a wiznet WIZ820io with the newer w5200 chip. The w5200 has 32KB of buffers (vs 16KB on w5100), and will run at up to 33.3mbs (megabits/second) over SPI (0.3mbs on w5100). I added the support mods for the W5200 to w5100.cpp and w5100.h in hardware/arduino/sam/libraries/Ethernet/utility/. There is also a minor/optional modification to Ethernet.h. Those updated files and early performance results (wizperf.txt) can be found at


Simple UDP tests included 8-byte echo latency (microseconds), UDP 1000-byte packet sends from DUE, and lossless receive rate for 1000-byte UDP packets. The wiznet chip devotes 2048 bytes to each send and receive buffer (per socket). UDP is a lossy protocol. TCP will typically be slower, but it is reliable and adapts to available bandwidth.

Results include tests on the UNO and maple. On the maple and DUE, one can test SPI+DMA. The wiznet site only guarantees 33.3mbs SPI performance for the W5200. I got reliable results at SPI speeds of 28MHz, but errors at 42MHz. The DMA network tests for the DUE are still in progress and will be posted later on this thread at the git URL above.

I was did a project about using DUE and W5100 shield as a HTML server in a LAN recently, but it was instable, on average every work two days die once, i don't know what reasons caused this problem. In before i was using UNO and it work well, i guess maybe the DUE is still in state of beta?

I've added the SPI+DMA w5200 Ethernet results to git link below. With DMA and SPI clock at 28 MHz, one gets nearly 16 million bits/second, about 3 times the SPI-only performance. The file w5100.cpp.dma1 is the modified version of w5100.cpp that supports w5200 and DMA+SPI. Results are in wizperf.txt at


DMA code is modified from fat16lib's SD work.


I finally got a couple WIZ820io with the W5200 chip. I'm trying to replicate your results on the Due but I'm running into difficulties.

I have it hooked up per the picture I made, hopefully this helps someone else or if I have it hooked up wrong please let me know:

My main problem is that using your modified Ethernet.h and updated w5100.cpp and w5100.h files I'm having a problem with the device locking up if I press the F5 button on my Firefox browser too many times. It seems that if I press the F5 key about once every half a second the Due will crash/lock up and afterwards will not respond to ping or http. Only a reset of the Due through pressing reset button or re-uploading the sketch will allow it to be pinged once again:

Let me know if you have any ideas, I would love to get this thing running reliably. I would hate to be impatient hundreds of miles from home and crash my due/W5200 remotely just because I was hitting refresh on my smartphone too often. Haha!

I'm running the WebServer sketch under: hardware\arduino\sam\libraries\Ethernet\examples\WebServer

I have been able to verify that the R3 version of the Arduino Ethernet shield running the W5100 chip does not suffer from this problem. In fact I can hold down the F5 key and it will not drop ping and will continue to respond to http.

I have exactly the same problem. Any help...

I have an alternative Wiznet W5200 library that I've ported from work I did with on previous Arduino boards, both 328 and 1284 based. Its at https://bitbucket.org/thiseldo/ethernet52due.

This doesnt replace the w5100.cpp and w5100.h files in the main distribution Ethernet library so will be available after fitire IDE updates. I've also updated it to use the extended SPI features as well as increasing the SPI clock to 42MHz. At present the examples are configured for this library, the only change you'd need to do to use it instead of the standard library is to use the header file Ethernet52Due.h instead of Ethernet.h. The library may still have problems as its still being worked on to improve performance and reliability.

Hope this helps.



Thanks for the link to your library.

I was able to download it and run the WebServer sketch and just like you said in another thread I was able to run 8 firefox tabs each pulling data every few seconds! Awesome! I was never able to do that with the official Ethernet shield so that is a positive step forward.

I was still having the same problem though where if I perform too many requests (pressing F5 in browser) to the W5200 chip it will basically lock up and stop responding to any GET requests from the browser and also stop responding to ICMP (PING). Even an hour later it still does not come out of the stuck condition.

Are you having the same problem?

I’m starting to think there may be a bug in the chip because the exact same thing happens when I have the W5200 chip hooked up to the Arduino UNO running Arduino IDE Version 1.0 with the official (from WIZnet) libraries:
If you go to the link above and click on the “Download” section there are a couple zip files containing WIZnet’s updated W5100.h and W5100.cpp files so you can run the W5200 chip. The code from WIZnet has the same problem locking up when too many requests come in. Maybe the request Internal 32 Kbytes tx/rx buffer is getting filled and causing it to crash?

Hello kcore, I just found in github (authored 2 days ago) the following Wiznet W5200 library by Jinbuhm Kim with contribution of Fabien Duay with the 32bit code. Kim works at Wiznet. I haven't checked out. May be is a fresh one or a redundant one.


It says: Update for supporting Arduino Due. It also says: Thanks "Matthew Lange".



Thanks for the heads up, I tried the code though and it has the same problem as the other code I have tried.

I guess at this point I'll attempt to reach out to Jinbuhm Kim and see if he has an idea what is going on. It seems like too many requests to the RX buffer of the W5200 is triggering a condition where it doesn't respond to any more requests. Since all the TCP/IP stack is contained within the W5200 chip it doesn't seem like this is an Arduino problem per se and may be a bug in the W5200 itself.

WIORE, have you been able to try any of the code? Are you still having the same problem? If so, we have a documented issue we can go to WIZnet and see if there is a fix or at least get them to acknowledge the problem.


Thanks for trying my effort at a Ethernet library for Wiznet5200 on Due. The w5200.cpp and w5200.h originally came from Wiznet some time ago and was a modification to the existing 5100 code to setup correct registers etc. I wasnt happy using them to replace the existing Arduino Ethernet code used that as a basis for a complete new library.

Using 8 connections at once may stretching it a bit as I've experienced the odd lockup and sometimes its decided not to work at all but think this might be down to my router. However I have been able to implement a small SD card based webserver that could serve a variety of file formats including html, jpg, gif, png etc so that simple web based management interfaces could be built onto any application running on the Due.

I have found that sometines the webserver sketch wont set the ip address correctly, even though it has been told what it is. As I'd said before, there are still some issues with it, but its a start.

One thing I had thought of, with regarding MAC addresses, is to use the unique code burnt into the SAM chip to form the basis of the MAC address. But not really started looking into this, other than reading the datasheet!



I hate to revive this thread, but I believe I fixed the refresh problem you were experiencing. I was having similar issues, but with a small modification to the library I resolved it. This is my first post, I was wondering if anyone can direct me to somewhere to note this bug for others?

Cheers, deception

Go ahead and put the information here if you could.

You can use code tags when you reply. Just click the # button when you make a reply and put the code or lines you changed in between the tags.

Once someone can confirm it has fixed it, mantoui can possibly update his files with the changes.


I actually posted to the GitHub repositories, so maybe they’ll merge the pull requests. Let me know if this resolves your issue!

You can find the fix below.



great code! i will be using this to read from an adc at 50kHz.. yielding about 1.2 Mbps traffic up and 600 kbps down. which should be peanuts compared to what you guys are doing with ethernet.

one question: can we use multiple dma streams at the same time? i see the code may need to be a bit extended? can the sam3x do this at all? typically, in a complex embedded system, there are multiple devices on the same SPI bus..