cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
14,594 Views
Registered: ‎11-16-2007

lwip v3.00.a and Webserver from XAPP433 on ML403

I upgraded to EDK9.2.1 because the slow webserver issue should be solved there (I was told).
 
in the lwip_v3_00_a.pdf document on Page 10 is a note, that the new function xemac_add is a unified interface to any Xilinx EMAC-IPs.
 
this Function calls the netif_add function (xemacliteif.c), that was called in the xapp433 webserver from xilinx.
There is also a low_level_init() function, which calls the register_interrupt_handler and enable_interrupt, which are needed for xilkernel.
 
So I dropped the register_int_handler and enable_interrupt from web_server.c and called xemac_add instead.
But I always get an sys_timeout, as if the the interrupts are not processed by the xilkernel.
 
On the bottom of Page 10 in the document, there is a note, that API Examples for RAW API and Sockets API are available on Xilinx Website, but there are only examples without using the new version of lwip.
 
Initializing the lwIP library...
sys_timeout: 0x8c0641d8 msecs=3e8 h=0x8c007ad4 arg=0x0
lwIP initialization done
MAC Address: 00-19-D2-59-C3-EE
IP Address : 192.168.0.20
Subnet Mask: 255.255.255.0
Gateway    : 192.168.0.13
netif_set_ipaddr: netif address being changed
netif: IP address of interface Î set to 192.168.0.20
netif: netmask of interface Î set to 255.255.255.0
netif: GW address of interface Î set to 192.168.0.13
netif: setting default interface ''
tcpip_thread: API message 0x8c064118
tcpip_thread: API message 0x8c064118
tcp_bind: bind to port 80
Socket-Number: 0Server initialization complete.
HTTP server is now accepting new connections on port 80
tcpip_thread: API message 0x8c064118
smf calling h=0x8c007ad4(0x0)
tcpip: ip_reass_tmr()
sys_timeout: 0x8c0641d8 msecs=3e8 h=0x8c007ad4 arg=0x0
smf calling h=0x8c007ad4(0x0)
tcpip: ip_reass_tmr()
sys_timeout: 0x8c0641d8 msecs=3e8 h=0x8c007ad4 arg=0x0
smf calling h=0x8c007ad4(0x0)
tcpip: ip_reass_tmr()
sys_timeout: 0x8c0641d8 msecs=3e8 h=0x8c007ad4 arg=0x0
smf calling h=0x8c007ad4(0x0)
0 Kudos
6 Replies
Highlighted
14,477 Views
Registered: ‎12-31-2007

I have tried to implement a reliable web server in EDK 7.1, 8.1, 8.2, and 9.2 with the Ethernet MAC, Ethernetlite MAC, hard temac in V4 (xps_ll_fifo, dma, plb_temac, opb_temac). I have yet to find a solution that is usable (> 1 MByte a second and doesn't crash with 100 calls/sec). The problems always seem to be in the Xilinx netif MAC drivers...

Try the following for lwip 3.00a in EDK 9.2.02:

#include "xmk.h"
#include "xparameters.h"
#include "lwip/inet.h"
#include "lwip/sockets.h"
#include "lwipopts.h"
#include "netif/xadapter.h"

struct netif g_server_netif, *g_server_netif_ptr;
unsigned char g_mac_ethernet_address[6] = { 0x00, 0x00, 0x01, 0x11, 0x22, 0x33 };
struct ip_addr g_ipaddr, g_netmask, g_gateway;
struct sockaddr_in g_address, g_remote;
int size, new_socket;

int main ()
{
XCache_EnableICache (0x80000000); // Enable I Cache for first 128Megs of RAM of PPC
XCache_EnableDCache (0x80000000); // Enable D Cache for first 128Megs of RAM of PPC
xilkernel_main();
return 0;
}

int server_thread ()
{
int i;

lwip_init();

xil_printf ("...server thread...\r\n");
sys_sleep (2000);
sys_thread_new (serverAppThread, 0, 1);
...


int serverAppThread ()
{
IP4_ADDR (&g_ipaddr, ip[0], ip[1], ip[2], ip[3]);
IP4_ADDR (&g_netmask, mask[0], mask[1], mask[2], mask[3]);
IP4_ADDR (&g_gateway, gw[0], gw[1], gw[2], gw[3]);

g_server_netif_ptr = &g_server_netif;
g_server_netif_ptr = xemac_add (g_server_netif_ptr, &g_ipaddr, &g_netmask, &g_gateway, g_mac_ethernet_address, XPAR_LLTEMAC_0_BASEADDR);
netif_set_up (g_server_netif_ptr);
netif_set_default (g_server_netif_ptr);
sys_thread_new (xemacif_input_thread, g_server_netif_ptr, 1);


new_socket = lwip_socket (AF_INET, SOCK_STREAM, 0);
g_address.sin_family = AF_INET;
g_address.sin_port = htons(80);
g_address.sin_addr.s_addr = INADDR_ANY;
lwip_bind (new_socket, (struct sockaddr *) &g_address, sizeof (g_address));
lwip_listen (new_socket, 0);
size = sizeof (g_remote);
new_socket = lwip_accept (socket, (struct sockaddr *) &g_remote, &size);

...

-----------------------------------

useful details:

BEGIN OS
PARAMETER OS_NAME = xilkernel
PARAMETER OS_VER = 4.00.a
PARAMETER PROC_INSTANCE = ppc405_0
PARAMETER sysintc_spec = xps_intc_0
PARAMETER stdout = RS232
PARAMETER enhanced_features = true
PARAMETER config_yield = true
PARAMETER config_kill = true
PARAMETER config_debug_support = true
PARAMETER config_sema = true
PARAMETER max_sem_waitq = 15
PARAMETER max_sem = 25
PARAMETER config_time = true
PARAMETER max_tmrs = 25
PARAMETER max_readyq = 15
PARAMETER n_prio = 8
PARAMETER max_pthread_mutex_waitq = 15
PARAMETER max_pthread_mutex = 15
PARAMETER pthread_stack_size = 25000
PARAMETER max_pthreads = 15
PARAMETER stdin = RS232
PARAMETER systmr_interval = 1
PARAMETER systmr_dev = fit_timer_0
PARAMETER static_pthread_table = ((server_thread,1))
END

BEGIN LIBRARY
PARAMETER LIBRARY_NAME = lwip
PARAMETER LIBRARY_VER = 3.00.a
PARAMETER PROC_INSTANCE = ppc405_0
PARAMETER phy_link_speed = CONFIG_LINKSPEED1000
PARAMETER memp_n_tcp_seg = 200
PARAMETER memp_n_tcp_pcb = 50
PARAMETER mem_size = 700000
PARAMETER tcp_snd_buf = 20000
PARAMETER tcp_wnd = 4000
PARAMETER memp_num_tcpip_msg = 100
PARAMETER memp_num_api_msg = 100
PARAMETER memp_num_netconn = 100
PARAMETER memp_num_netbuf = 100
PARAMETER memp_n_sys_timeout = 5
PARAMETER memp_n_tcp_pcb_listen = 5
PARAMETER memp_n_udp_pcb = 5
PARAMETER api_mode = SOCKET_API
PARAMETER lwip_udp = false
PARAMETER pbuf_pool_size = 200
PARAMETER ip_reassembly = 0
PARAMETER memp_n_pbuf = 10
END

look for the warning in tcp_out.c or tcpout.c when in builds lwip 3.00a - change the variable if complains about (queue length something) from u8_t to u16_t (I can not access the files now or I would provide better information on this.)

Nathan
0 Kudos
Highlighted
Visitor
Visitor
14,313 Views
Registered: ‎08-23-2007

Hello,

In C++, under SDK using microblaze, I ve got exactly the same problem you have, schleifer.
Everything seems correct, I don t understand...

I also used your source code, nathanmariels, but it gave me the same result :(((

Any idea ?

Regards,

Spiken.
0 Kudos
Highlighted
Observer
Observer
14,311 Views
Registered: ‎11-16-2007

I've got an working Project for ML403. This contains only a echo server and not a webserver.
You may get this Design if you send me a privat message with your Email Adress.
0 Kudos
Highlighted
Observer
Observer
14,279 Views
Registered: ‎10-16-2007

Hi guys,
 
i had porblems with the lwip library when i ported my design from edk 9.1 to edk 9.2.
the lwip was rewritten and had some bugs. update your edk 9.2 with service pack 2 and it should work.
 
cheers,
mc
Highlighted
5,900 Views
Registered: ‎10-13-2010

hi, i want to implement simple echo program for ML403 in EDk 10.1 using lwip and temac. please send me any working program

0 Kudos
Highlighted
5,827 Views
Registered: ‎10-13-2010

please send me the program on my mail id

shashishekhar@bel.co.in

regards

shashi

0 Kudos