Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

LwIP / UDP

Altera_Forum
Honored Contributor II
1,880 Views

Hi, 

 

i'm working with the LwIP (standalone version) TCP/IP Stack on a NIOS II system and want to use it to send UDP messages. My problem is that when I call the udp_send() function the system is dead. At the end 

of this funktion a pbuf_free call kills it with the message  

"Assertion "pbuf_free: sane flags" failed at line 556 in ../lwip-0.7.1/src/core/p 

buf.c" 

 

Has somebody a explanation for this?  

 

Thankx a lot 

revolt 

 

My code: 

 

pbuf1 = pbuf_alloc(PBUF_TRANSPORT,100,PBUF_RAM); //Get a pbuf struct. 

udpSkt = udp_new();  

udp_bind(udpSkt,IP_ADDR_ANY,1024); 

IP4_ADDR(&udpDestIpAddr, 192, 168, 0, 10); 

udp_connect(udpSkt,&udpDestIpAddr,69); //Set-up socket withdest IP and port. 

udp_recv(udpSkt,&udp_recv_packet, &FillBuff);  

 

// Send wrq 

pbuf1->payload = (void*)wrq; 

pbuf1->tot_len = 17; 

pbuf1->len = 17; 

-> udp_send(udpSkt,pbuf1); <-
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,130 Views

Has somebody a example for using lwip (standalone version) and UDP to send data? 

 

My board sends an ARP and then its dead. 

 

regards revolt
0 Kudos
Altera_Forum
Honored Contributor II
1,130 Views

Dear Revolt, 

 

I am sorry ...i havn't come with solution...rather i am looking for sample UDP code who will communicate from NIos to PC through UDP, as your problem says that you have write udp code which communicate with pc. so please share with me this peace of information 

 

kaushal
0 Kudos
Altera_Forum
Honored Contributor II
1,130 Views

 

--- Quote Start ---  

Hi, 

 

i'm working with the LwIP (standalone version) TCP/IP Stack on a NIOS II system and want to use it to send UDP messages. My problem is that when I call the udp_send() function the system is dead. At the end 

of this funktion a pbuf_free call kills it with the message  

"Assertion "pbuf_free: sane flags" failed at line 556 in ../lwip-0.7.1/src/core/p 

buf.c" 

 

Has somebody a explanation for this?  

 

Thankx a lot 

revolt 

 

My code: 

 

pbuf1 = pbuf_alloc(PBUF_TRANSPORT,100,PBUF_RAM); //Get a pbuf struct. 

udpSkt = udp_new();  

udp_bind(udpSkt,IP_ADDR_ANY,1024); 

IP4_ADDR(&udpDestIpAddr, 192, 168, 0, 10); 

udp_connect(udpSkt,&udpDestIpAddr,69); //Set-up socket withdest IP and port. 

udp_recv(udpSkt,&udp_recv_packet, &FillBuff);  

 

// Send wrq 

pbuf1->payload = (void*)wrq; 

pbuf1->tot_len = 17; 

pbuf1->len = 17; 

-> udp_send(udpSkt,pbuf1); <- 

--- Quote End ---  

 

 

Almost always this sane pbuf message is caused from memory overwrite during program run. Is you stack size good? Are you checking return values from lwIP and runtime functions? If you're using an RTOS, lwIP can be accessed from only one thread. 

 

Bill
0 Kudos
Reply