Hello! Forwarding this to a more appropriate list; see <http://savannah.nongnu.org/mail/?group=lwip>.
Regards, Thomas
--- Begin Message ---Hello everyone, I'm not sure if I have the right channel to ask my questions, so my appollogies if it's not. For a research project I'm doing some benchmarks to see what the impact of the LwIP stack is on a ARM7 (LPC2388). To test the receiving of data via TCP I've programmed the code at the end of this e-mail. For some reason, when I'm using a interrupt to call tcp_tmr() every 250 ms, the proc. stops at (what appears to be) a random time and reboots. When I disable the interrupt/timer 1, and just put the tcp_tmr call in main everything just works fine. Using the same method when sending data works fine though.... I think its memory releated. Does anybody know what I'm doing wrong, and is it possible to use interrupts as described? Many thanks in advance for the help, I really appreciate it! :-) Greets, Niels Code from Main.c: << all of the nessecary includes >> static void tcpInit(){ unsigned int start = 0; unsigned int stop = 0; lwip_init(); /* Functioncall to initialize the LwIP protocolstack */ tcp_tmr(); /* Mandatory call to tcp_tmr, required by lwip_init(), has to be called every 250ms */ } err_t data_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) { if(p != NULL){ total_bytes_received += p->len; tcp_recved(tpcb, p->len); pbuf_free(p); } else{ pbuf_free(p); LCD_cls(); LCD_puts("CONN CLOSED"); return ERR_OK; } return ERR_OK; } err_t accept_callback(void *arg, struct tcp_pcb *pcb, err_t err){ tcp_arg(pcb, NULL); tcp_recv(pcb, data_recv_callback); return ERR_OK; } static int setup_passive_tcp_connection(){ /* Protocol Control Block for the active tcp connection */ struct tcp_pcb *pcb; struct tcp_pcb *tcpweb_listen; /* Fill the struct for the receivers ip address */ //IP4_ADDR(&recvr_ipaddr_data, 192, 123, 0, 105); pcb = tcp_new(); /* Bind to a portnr, doesn't matter what interface, perform availability check */ if(tcp_bind(pcb, &my_ipaddr_data, 8282) != ERR_OK){ return FALSE; } /* Register callback function, that is to be called on succesfull connection */ tcpweb_listen = tcp_listen(pcb); if (tcpweb_listen == NULL) { tcp_abort(pcb); pcb = NULL; return FALSE; } pcb = tcpweb_listen; tcp_accept(pcb, accept_callback); return TRUE; } int main (void) { TICKER1_Start(); // start timer 1, interrupts every 250 ms to call tpc_tmr(); LCD_init(); // init the lcd bmrk_init(); // init the own written benchmark module... LCD_init(); tcpInit(); TICKER0_Start(); // start timer0 later because it calls LWIP functions! LCD_cls(); LCD_puts("BENCHMARK.."); LCD_gotoxy(1,2); // move LCD cursor to 2nd line (x,y) LCD_puts("Passive TCP ref"); bmrk_fill_view(); // fill a array with things that has to be displayed on screen, using UART1 if (setup_passive_tcp_connection()){ while(TRUE){ ethernetif_handlepackets(netif_eth0); bmrk_fill_view(); bmrk_display_results(); } } return FALSE; }
--- End Message ---
signature.asc
Description: Digital signature
