element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development zedboard ethernet udp communication
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 6 replies
  • Subscribers 331 subscribers
  • Views 3017 views
  • Users 0 members are here
Related

zedboard ethernet udp communication

Former Member
Former Member over 9 years ago

Hello

I´m just playing with ethernet with zedboard. I made simple design with only PS part of Zynq and reworked SDK lwip raw tcp echo example to udp. Everything works fine but I would like to ask some questions.

Performance:

I have measured transmit output with Jperf (GUI version of iperf utility). UDP payload size was 500B with achieved circa 400Mbit/s and for 1000B payload I got around 700Mbit/s bandwidth performance. Bigger payload per datagram is irrelevant for me because of app layer protocol what I'm gonna use.

In XAPP1026 document there is the chapter about measured performance (page 23 - lwip performance). As you can see...about 900Mbit/s can be achieved with raw TCP (!!!) on the board ZC702.

Did I overlook something? ZC702 have same cpu (666MHz) like zedboard and similar PHY ethernet chip (marvell).

Here is sample of my code:

void myudp_client_init(void)
{
    ip_addr_t DestIPaddr;
    err_t err;
    upcb = udp_new();
    if (upcb!=NULL)
    {
        IP4_ADDR( &DestIPaddr, DEST_IP_ADDR0, DEST_IP_ADDR1, DEST_IP_ADDR2, DEST_IP_ADDR3 );
        err= udp_connect(upcb, &DestIPaddr, UDP_SERVER_PORT);
        if (err == ERR_OK)
        {
            /* Set a receive callback */
            udp_recv(upcb, udp_receive_callback, NULL);
        }
    }
}

static void myudp_client_send(void)
{
    struct pbuf *p;
    static int counter = 0;
    sprintf((char*)data, "counter>%d", counter++);   //for evaluation of received datagrams
     p = pbuf_alloc(PBUF_TRANSPORT,PAYLOAD_SIZE, PBUF_POOL);
    if (p != NULL)
    {
        pbuf_take(p, (char*)data, PAYLOAD_SIZE);  //PAYLOAD_SIZE tried from 200B to 1000B
        udp_send(upcb, p);
        pbuf_free(p);
    }
}

I just call myudp_client_send() while button is pushed. Received datagrams are checked in Wireshark.

 

General question about lwip raw mode:

While I was reading various documentation and example codes of RAW mode for different platforms (Atmel, NXP, STM32...) I always find necessity of calling sys_check_timeouts function in while(1) next to variation of function ethernetif_input (it's called xemacif_input in Xilinx lwip port ). Why is it not in xilinx LWIP examples? Are timers timeouts handled implicitly?

  • Sign in to reply
  • Cancel

Top Replies

  • jafoste4
    jafoste4 over 8 years ago in reply to janani.subraveti@gmail.com +1
    Hi, Have you tried the lwIP Demo Application template in SDK? Compare it to what you currently have. --Josh http://microzed.org/content/udp-frames-zedboard
Parents
  • narrucmot
    0 narrucmot over 9 years ago

    Hello,

    My experience with LwIP tells me that the BSP settings in the Xilinx SDK for the LwIP library have a significant influence on the bandwidth that can be achieved, especially the tcp_options -> tcp_mss setting.  The larger this number can be the greater the throughput that will be achieved, but I have found that the default (1460 bytes) is too big and thus has a big negative effect on throughput.  Below is some information and description on these BSP settings and the effect they have on throughput.  The design described is a MicroBlaze and EthernetLITE  design on the Avnet 7A50T Artix-7 board, but that is OK.  The BSP settings still apply to LwIP and GbE on Zynq.

    Examine the Board Support Package Settings

    Any software application built in the SDK requires a Support Package (BSP) on which individual projects can be built.   Multiple BSPs and multiple application projects can be held in a single SDK workspace.  The BSP required to run the lwIP applications was built when we created the software application, and it includes many settings that significantly impact Ethernet performance.  We will examine those settings in the steps below.

    1.   Right click on the lwip_raw_apps_bsp in the Project Explorer pane and select Board Support Package Settings
    1.   Notice that the lwip141 and xilmfs libraries are already selected in the BSP.  These were selected automatically when we create the lwip applications software project from the repository we added earlier.  Do not click OK yet.
    1.   In the left panel, select lwip141 for the standalone OS to see the detailed parameters available for the lwIP library and click to expand the tree for the temac_adapter_options settings.
    1.   To maximize Ethernet throughput it is necessary to increase the number of Tx and Rx descriptors to be used.  The optimal value for the number of n_tx_descriptors and n_rx_descriptors for this example design is 256.  We also need to set the phy_link_speed to CONFIG_LINKSPEED100.  Normally it would be desirable to leave this set for auto-negotiation, but this setting is PHY dependent and has only been tested with Marvell PHYs used on Xilinx development boards.  The maximum throughput of the axi_ethernetlite peripheral is 100Mbps, so we set the link speed to 100Mbps here.  This setting must be correct and must match the capabilities of the Ethernet MAC and PHY in order to transmit and receive packets.  Do not click OK yet.
    1.   Click to expand the tree for the lwip_memory_options:
    1.   Our webserver file system is essentially a RAMdisk because it resides in system DDR3 memory and serves a few files while also allowing us to monitor the status of board GPIO.  To maximize this file serving performance we need to set the number of memp_n_pbuf and memp_n_tcp_seg to 1024.  Notice the value of mem_size.  This is equivalent to the amount of heap space that we specified in the linker script.  Do not click OK yet.
    1.   Click to expand the tree for the pbuf_options:
    1.   Packet buffers (Pbufs) carry packets across various layers of the TCP/IP stack. To increase our Ethernet performance we need to increase the pbuf_pool_size to 1024.  Do not click OK yet.
    1.   Click to expand the tree for the tcp_options settings:
    1.   To maximize the use of the hardware Rx ping-pong buffers it is necessary to increase the size of the TCP window.  A standard Ethernet frame is 1518 bytes long, so each buffer can hold a single frame.  By default, the receive window is set at 2048 bytes, meaning only one frame can be in transit before an acknowledgement is sent to the host.  We can double the size of tcp_wnd to 4096 bytes to allow a second frame in transit, which will better utilize the available bandwidth.  Experiment with this parameter to see how higher and lower values affect the throughput on your system.  Do not click OK yet.
    1.   To maximize the Tx throughput it is necessary to make the maximum segment size slightly smaller than the default.  The maximum segment size controls the amount of payload bytes per IP packet.  Ideally this value is as large as possible to maximize the transmit efficiency.  For this MicroBlaze system connected over Ethernet to a Windows host computer, the best transmit throughput was achieved with a tcp_mss value of 1458 bytes.  Experiment with this parameter to see how higher and lower values affect the throughput on your system.  Do not click OK yet.   
    1.   Click to expand the tree for the dhcp_options settings:
    1.   Even though this example design prescribes connecting the evaluation board directly to the host PC with a static IP address, the lwIP stack is capable of fetching its IP address from a DHCP server (probably an Ethernet router) on the network.  To enable this capability set lwip_dhcp to true.  If a DHCP server is not found when the lwIP stack initializes at power on, it will default to an IP address of 192.168.1.10.  This is the behavior seen in the demos described earlier in this tutorial.  Do not click OK yet.

    Hopefully this is helpful for you.

    --Tom

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • janani.subraveti@gmail.com
    0 janani.subraveti@gmail.com over 8 years ago in reply to narrucmot

    Hi, I could make my own code of udp communication over zedboard, but there is problem with the receiving of user datagram... and i have took a buffer to copy the received payload into it and tried to print it over the console of sdk.But i could not print anything over the console.. and the problem is with the receiving of the data ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jafoste4
    0 jafoste4 over 8 years ago in reply to janani.subraveti@gmail.com

    Hi,

    Have you tried the lwIP Demo Application template in SDK? Compare it to what you currently have.

    --Josh

    http://microzed.org/content/udp-frames-zedboard

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • janani.subraveti@gmail.com
    0 janani.subraveti@gmail.com over 8 years ago in reply to jafoste4

    Ya, I have already tried... and when I construct my udp echo program in the same way.. iam not receiving any data.. because i copied the payload into a buffer and trying to print it over the console and couldnot find anything inside the buffer.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • janani.subraveti@gmail.com
    0 janani.subraveti@gmail.com over 8 years ago in reply to jafoste4

    Ya, I have already tried... and when I construct my udp echo program in the same way.. iam not receiving any data.. because i copied the payload into a buffer and trying to print it over the console and couldnot find anything inside the buffer.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube