Panda II + Ethernet Shield + Performance

Hello,

I purchased a FEZ Panda II and the Ethernet Shield. According the website the speed should be up to 400kbit/s. THe problem is, that this speed is only reached when uploading from the Panda to another destination. Unfortunatly the download speed is anly about 80kbit/s, whihc is too slow for my usecase (I want to grab JPEGs from an IP CAM and upload it to another software which runs on a webserver). For this use case 400kbit/s would be anough if I would be able to achieve this rate in both directions.

Is there anything I can do to speed up TCP or HTTP downloads?

I simulated the CAM with my computer on the LAN and used the following code to measure the speed:

byte[] mac = { 0x00, 0x26, 0x1C, 0x7B, 0x29, 0xE8 };
WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10, (Cpu.Pin)FEZ_Pin.Digital.Di7, true);
//WIZnet interface on FEZ Connect32.
Dhcp.EnableDhcp(mac, “panda”);

        Debug.Print("Network settings:");
        Debug.Print("IP Address: " + new IPAddress(NetworkInterface.IPAddress).ToString());
        Debug.Print("Subnet Mask: " + new IPAddress(NetworkInterface.SubnetMask).ToString());
        Debug.Print("Default Getway: " + new IPAddress(NetworkInterface.GatewayAddress).ToString());
        Debug.Print("DNS Server: " + new IPAddress(NetworkInterface.DnsServer).ToString());

Socket socket1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
EndPoint ep1 = new IPEndPoint(IPAddress.Parse(“192.168.100.11”), 2001);

        socket1.Connect(ep1);
        Debug.Print("Connected to CAM");

        int i;
        int bytecount = 1024;
        byte[] buffer = new byte[bytecount];
        while (true)
        {
            i = socket1.Receive(buffer);
          
        }

Hope I can speed up things anyhow? (maybe RLP?)

Regards,

Alex

Welcome to the forum.

Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)

Here is the code again:

byte[] mac = { 0x00, 0x26, 0x1C, 0x7B, 0x29, 0xE8 };
 WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10, (Cpu.Pin)FEZ_Pin.Digital.Di7, true);
 //WIZnet interface on FEZ Connect32. 
Dhcp.EnableDhcp(mac, "panda");

 Debug.Print("Network settings:");
 Debug.Print("IP Address: " + new IPAddress(NetworkInterface.IPAddress).ToString());
 Debug.Print("Subnet Mask: " + new IPAddress(NetworkInterface.SubnetMask).ToString());
 Debug.Print("Default Getway: " + new IPAddress(NetworkInterface.GatewayAddress).ToString());
 Debug.Print("DNS Server: " + new IPAddress(NetworkInterface.DnsServer).ToString());
 
Socket socket1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 EndPoint ep1 = new IPEndPoint(IPAddress.Parse("192.168.100.11"), 2001);
 
socket1.Connect(ep1);
 Debug.Print("Connected to CAM");
 
int i;
 int bytecount = 1024;
 byte[] buffer = new byte[bytecount];
 while (true)
 {
 i = socket1.Receive(buffer);

 }
 

you’re expecting too much from this module. There’s little memory on the Panda once you get netowrking enabled, and it uses a serial connection.

How are you measuring the download rate? I can’t see anything that tries to do that in your code.

Hey Alex - you can also edit posts… no need to repost the same thing. I’m with Brett - you may be asking too much of the Panda2.

Sorry I’m new to this forum. Will keep this in mind for the future!

I measured th speed on my PC. I used the task-manager to see throughput on network interface.

But why is upload from Panda to server 4 times faster than download data from server to panda. I just posted the code so that you can see that there is no processing of the transfered bytes. I am just sending/receiveing dummy data…

try increasing the size of your receive buffer to 1600 bytes.

Thanks for your answer. I already tried different buffer sizes, like 512,1024,4096, but it really does not make a real speed difference…
Can somebody here confirm that the Panda II has “performance problems” when receiveing?

Thanks!

Best regards,

Alex

I would not go as far as saying there is a receive problem. as said before there is limited processor power.

I really do not expect too much from the Panda, but what I expect is that it achieves a similar result as advertised on the GHI webpage. I purchased it because of this. I transfer rate of 30-40 kbyte/s would be OK for my needs.

It seems it is not related to its processing power, because when sending from Panda to a server I get a transfer rate of about 30-40kbyte/s. But I do not get this rate when receiving, i.e. there is something wrong with firmware, configuration etc…
Now I want to find out what is wrong and why the receive rate is so low. I’m hoping to find an answer from a specialist here in the forum. Maybe there is somebody who wants to compare his results with mine?

Thanks a lot!

Best regards,

Alex

No I still think you do expect too much; from the module, from the approximate numbers reported on a website (even if it is GHIs), and from the correctness of a test that you have not explained.

What is your code that you’re using to send data between the two. That is an unexplored, unexplained piece of the problem state. What analysis have you performed at a network layer, to understand what your test is doing and what other network conditions are in place when you do the test?

To achieve maximum throughput you need to control many things and optimise many things; as Mike says, alignment with a maximum MTU size will actually give you a better result, but you need to make sure that the overhead in your packet doesn’t cause fragmentation.

As far as someone else wanting to prove anything, I am guessing you may not find anyone overly concerned about this, and willing to set up a test.

Hello Brett,

thanks for you response. Here are my test details:

Server Code:

  TcpListener listener = new TcpListener(2001);

            listener.Start();
            TcpClient c  = listener.AcceptTcpClient();

            Stream s = c.GetStream();


            byte[] buffer = new byte[1024]; //tried different buffer sizes...
            while (true)
            {
                s.Write(buffer, 0, buffer.Length);
            }

I tried several buffer sizes, but download is only 1/4 of the upload speed. This is what makes me thinking. I assume we all want to get most out of the hardware. And I see no technical problems to have a similar download speed compared to the upload speed. What do you think?

I tested Upload speed with similar code. Instead of socket.write, I use socket.read…

Thanks.

Best regards,

Alex

1 Like

@ Alex111 -

In theTcpClient object have you set the NoDelay property to true?

Hello Mike,

thanks for your suggestion.

Yes, I already tried this, but nothing changed…

I tried so much things, so I think it could be caused by the GHI WIZNET driver?

Best regards,

Alex

Maybe there is somebody out there who can measure the download speed of Panda II + GHI Connect Ethernet Shield. I cannot get beyond 10kbyte/s, but Hardware should be capable of about 40kbyte/s (as I can upload with this speed)…

Thanks!

Still not sure why you think that the code should be symmetric and give you symmetric performance.

What have you found from netmon?

Sending is much simpler than receiving. You will probably get thd speed you need of you use the Wiznet chip directly instead of using the sockets wrappers.

FYI:

  1. The statement about the speed is on http://www.ghielectronics.com/catalog/product/261, “up to 500 kbit/s speed”. (What is the limiting factor? The SPI interface?)

  2. I have the same setup (Panda II + FEZ Connect) and today I measured the speed from the Panda. I got a similar result as reported here, 31 kilobyte/second, using the code example (TCP) at GHI Electronics – Where Hardware Meets Software, just slightly modified to send more data instead of the short HTML. I measured the speed by letting Wget retrieve the web page:

--2012-07-30 22:41:05--  http://192.168.2.227/
Connecting to 192.168.2.227:80... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified
Saving to: `o:/temp2/xyz3.html'

    [                                       ] 1,638,400   31.2K/s   in 51s

2012-07-30 22:41:59 (31.2 KB/s) - `o:/temp2/xyz3.html' saved [1638400]

@ Gus:
Thanks for explaining. Can you give me an idea where to start, when you say “using the Wiznet chip directly” ? Do you think I can get that speed with plain netmf or do I need to switch to RLP?

@ Peter
seems you measured the speed from Panda to you computer. Please could you test the other way, too? Thanks a lot!

@ all
I also would like to know what is the limiting factor? Is it interpreted netmf code, or is it the SPI interface or is it the wiznet chip?

Thanks!

This is the chip used http://www.wiznet.co.kr/

There are many drivers for it around the web. Some code should help.