W5200 ethernet performance with QuickStart
manitou
Posts: 29
I hooked up WIZ820io (W5200 chip) on a breadboard to quickstart and used W5200/SPI library from the following
http://code.google.com/p/propeller-w5200-driver/source/checkout
Wiznet specs the W5200 at 33mbs (megabits/sec) compared to 0.3 mbs for the older W5100. A simple test of writing/reading the W5200 buffers ran at 8.9/5.3 mbs on the quickstart. Some simple UDP tests achieved 3mbs. For W5200 performance on other MCUs (UNO, DUE, maple, teensy) see wizperf.txt at the following github site
https://github.com/manitou48/DUEZoo
http://code.google.com/p/propeller-w5200-driver/source/checkout
Wiznet specs the W5200 at 33mbs (megabits/sec) compared to 0.3 mbs for the older W5100. A simple test of writing/reading the W5200 buffers ran at 8.9/5.3 mbs on the quickstart. Some simple UDP tests achieved 3mbs. For W5200 performance on other MCUs (UNO, DUE, maple, teensy) see wizperf.txt at the following github site
https://github.com/manitou48/DUEZoo
Comments
Nice work on gathering these stats, thanks for posting this.
DE Nano here, in case a single cog version of Tachyon appears.
Re: TCP I'm pretty sure the TCP on beagle/raspberry can perform as well as UDP on local net with bigger block transfers and larger window sizes -- I just took default settings. TCP provides reliable service and adapts to available bandwidth, whereas UDP can lose packets, have errors in packets, or have packets arrive out of order or even be duplicated. But UDP is a good measure of underlying performance
Re: W5200 buffers The default w5200 configuration allocates 2k-byte buffers per socket. For UDP that allows the wiznet to receive up to 2k at wire speeds, otherwise, as noted, the wiz performance is limited by SPI performance. Larger wiz buffers would allow buffering larger bursts of UDP packets. Though the w5200 specs says it can handle 80MHz SPI, wiznet also says they only have reliably tested it up to 33Mhz. Those high rates would be hard to sustain in a breadboard configuration.
Just for the record, the WIZ820io chip I have seems a bit tempermental -- irrespective of the MCU used to exercise it. Sometimes several repetitions of tests will fail and then start working ...
Another look (admittedly superficial) at the resuts seems to convey insight about the SPI and CPU load issue. Most apparent with the DUE and Maple is the difference in the way UDP performance scales with SPI clock for regular SPI vs. DMA+SPI. Namely it scales semi-directly for SPI, but only up to a point, beyond which it continues to scale higher with SPI+DMA. Most obvious example is Maple: Regular SPI UDP performance is the same for 9 or 18 MHz SPI clock where SPI+DMA at 18 MHz delivers a lot more performance than 9 Mhz. The implication I draw is that the CPU is saturating driving the regular SPI. Advantage Prop which has plenty of cogs and memory for other stuff.
Sending 100 1000-byte records, or receiving 100 1000-byte records.
Anyway to characterize the CPU load on beagle/pi? Are they saturated, or scheduler is saving bandwidth for other tasks? Just curious...
Mind trying the same tests with this driver?
The underlying SPI code for this driver looks about the same -- write/ read are clocked at 20MHz/10Mhz using frqa. The test of just writing/reading 1000 bytes to the W5200 socket buffer area ran slower at 6.4/4.9 mbs (megabits/sec), compared to 8.8/5.3mbs to the other driver. The other driver combines the first 4 bytes (W5200 command) into a single SPI write operation, so that may account for some of its speed.
Presumably UDP and TCP would run proportionally slower as well. I haven't done the UDP tests since txUDP in this driver wants me to build a UDP header at the front of my data...
Hmmm this is a touch disappointing, I would have expected the same speed or better. I suspect the spin overhead is killing my speed.
I will check that out. My driver is utilizing the W5200s "burst" mode, so after the first byte is sent (40bits total) I only send data bytes (8 bits).
I tried a simple UDP echo test with txUDP -- txUDP never returns, sigh. W5200 responds to pings. I commented out the first "if" in txUDP and that let it "run" -- but there were no UDP packets seen on the Ethernet (tcpdump). Do you have a working UDP example?
The other W5200 driver had lots of examples, so it was easy to create various tests ....
thanks
The driver I'm pointing you to is a rework of the W5100, so all the examples that Timothy created for the W5100 should work. I've attached one that demonstrates UDP.
Otherwise, thank you for your test results. I was able to identify a bottle neck in my code which I'm actively fixing.
Yes, I used socket.Available, i'll try your suggestion. Here are snippets of code being measured.
thanks for the w5200 code
Thanks for the posting, helpful to illuminate some optimization ideas.
Yep the receive buffer can contain more than one packet. I've running performance tests this weekend and built a few testing applications. I'm still trying to make sense of results.
As twc mentioned, at least for W5200.spin, the buffer logic sucks up a lot of ticks. I'll offload that logic to PASM and that should speed things up. I'm pretty sure multiple UDP packets in the Rx buffer is always a possibility.