UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
50 Views
Registered: ‎12-20-2017

Baremetal UDP application with ZynqMP

I am tryiing to come up with a small baremetal application to send UDP traffic to test some hardware.  I found a few sample applications online that demonstrate udp functionality, but none of them are working for me right now:

I have a sample app that doesn't seem to work at the moment, at least as determined by my view of wireshark:  Every time I attempt to send a udp packet, I see an ARP request come out, and I see the response coming back to the target board, but no UDP. 

The main gist of the code is below, with error checking and declarations excluded for brevity.

 

    lwip_init();
    xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, PLATFORM_EMAC_BASEADDR0)    
    netif_set_default(netif);
    netif_set_link_up(netif);
    netif_set_up(netif);
    Xil_ExceptionEnable(); //Setup complete start interrupts
    udp_1 = udp_new();
    udp_bind(udp_1, IP_ADDR_ANY, 1069);
    udp_connect(udp_1, &ipaddr_remote, 1069);
    udp_recv(udp_1, recv_callback_udp, NULL);
    int loop_count = 0;
    while (1) {
        xemacif_input(netif);
        usleep(1000);
        if (loop_count < 100) {
            p = pbuf_alloc(PBUF_TRANSPORT, buflen, PBUF_POOL);
            if (!p) {
                xil_printf("error allocating pbuf\r\n");
                return ERR_MEM;			
            }
            memcpy(p->payload, (char *)&data_value[0], buflen);
            error = udp_send(udp_1, p);
            if (error != 0) {
                xil_printf("Failed %d to send\r\n", error);
            }
            count = 0;
            pbuf_free(p);
        }
        loop_count++;  
    }
0 Kudos