lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] pbuf multiple assertions


From: Víctor Mateo
Subject: Re: [lwip-users] pbuf multiple assertions
Date: Tue, 29 May 2012 17:25:30 +0200
User-agent: Mozilla/5.0

 

On Behalf Of V?ctor Mateo We have an annoying error using lwIP. Our software is a NIOSII C/C++ application, without Operating System and Superloop.
We are experiencing intermittent errors while trying to receive an UDP message, proccess data and send this proccesed data back.
Two common errors that we get on NIOS console are:
-Assertion "bad pbuf type" failed at line 548 in ../lwIP/src/core/pbuf.c
-Assertion "p->ref == 1" failed at line 599 in ../lwIP/src/core/ipv4/ip.c
Can we see the UDP packet handling code?  It sounds like memory overwriting or using a NULL pbuf.

 

Bill
 
 

Yes. Here is the Rx_UDP() and callback function UDP_Decoder():

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

static void UDP_decoder(void *arg, struct udp_pcb *pcb_new, struct pbuf *p, struct ip_addr *addr, u16_t port)

{
alt_u8 *param_pointer;
Rx_Command= NONE;
LWIP_UNUSED_ARG(arg);
if(p == NULL)
return;
memcpy ( buf, p->payload, MAX_UDP_LENGHT );

if( !strncmp ( (void*) HEADER_PARAMS, (void*)buf,6 ) ) {
//:More Code Here://
}
else if( !strncmp ( (void*) HEADER_PARAM2, (void*)buf,6 ) ) {
//:More Code Here://
}

pbuf_free(p);
udp_remove(pcb_new);

}


void Rx_UDP() {
struct udp_pcb *pcb_new;
pcb_new = udp_new();
udp_bind(pcb_new, IP_ADDR_ANY, FPGA_PORT);
udp_recv(pcb_new , UDP_decoder, NULL);
}

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

We call Rx_UDP() in an infinite while(1), so we can update parameters anytime we send it trough the host.

Maybe I am not "closing" fine pbuf or pcb? Should I use "udp_disconnect(pcb_new)" or anything else?

 

 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]