Jaime Fernandez Hoffiz | 29 Jun 01:25 2016

Implementation Suggestion

I'm working on a modem implemented on a omapl137. I've been able to get the tcp echo up and running, thanks to the awesome community. I have sort of a design consultation.

I see lwip has various level of implementations,

netconn, raw api, and what I'm currently using: lwip_accept

Which one would you suggest I use?

All seem to be non blocking and fit my needs.

lwip-users mailing list
Danil Kaykov | 28 Jun 13:41 2016

How to check connection

Hi all.

I need correct way to check state of the connection, and if it is aborted/disconnected/etc, reconnect.

Now I do it with the help of test sending some data.

In a separate thread ...

for( ;; )

// check connection...

    /*while(netconn_write(conn, (void*)"1", 2, NETCONN_COPY)!=ERR_OK)
       err = netconn_connect(conn, &DestIPaddr, 8080);
       if(err!=ERR_OK) continue;
    if (netconn_recv_tcp_pbuf(conn, &pbuf) == ERR_OK)          

                // some processing....



lwip-users mailing list
Gabriel Harrison | 27 Jun 12:41 2016

Correct way to free pbufs after tcp_recv callback finished



We’ve started our first lwIP project, following the instructions on http://lwip.wikia.com/wiki/Raw/TCP to create our high level functions and taking the device level IRQ functions and ethernetif.c from the SDK for our chip (Freescale Kinetis K60)


Although we appear to have set things up correctly – we can send & receive requests – the TCP pbufs pool is not running out and it looks like they are not being freed after the receive has been processed.


I can see in tcp_recv_null in tcp.c that pbuf_free(p); is called after tcp_recved(pcb, p->tot_len); but I can’t find any info about freeing the pbufs in the wiki via either pbuf_free or pbuf_free_callback.


Should I be calling pbuf_free/ pbuf_free_callback in our receive callback or is this supposed to be handled elsewhere?





This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
lwip-users mailing list
lampo | 23 Jun 07:48 2016

LwIP multithread select mode problems

can someone help me with multithread problem ? 

we use lwip 1.4.1 in PLC products, and if it live through long time(1 month
for example) testing in industry use, 
I will back here to report.

*our problem*
we use multithread select mode in our system, and it "seems" it's ok till
now(1 days passed),
but I see the doc in rawapi.txt,"/Netconn or Socket Api are not reentrant at
the control bolck granularity level/" .
so I really cannot figure out if im doing right thing.

*our application background/restriction*

a, our system is RTOS based , we need 2 TCP clients(separately connecting to
2 TCP servers, i.e., 2 lasers), 
1 TCP server(deal with max of 4 remote clients,i.e.,4 modbus clients ), and
1 web server.

b, lwip related thread cannot be in polling mode, for here is already a
polling thread in RTOS and it has "soft real time" requirements.

c, current lwip version is 1.4.1(we are evaluating 2.0.0)

d, we need to send data to tcp servers periodically, 10 ms

*our design/implementation *

3 thread has used 'select' , but the same socket is only closed by the
thread who created it. here is details,

we use 'select'  in "user tcp client send thread" ,we first call
'connect',and then call 'select' to determine whether the socket is
connected correctly or not; if some errors detected in connecting or data
sending, we call 'close' to close the socket.
we use 'select'  in "user tcp client receive thread", blocked forever
waiting for data, and call 'recvfrom' if data received, if some errors
in this thread,we don't just clost the socket ,but send message to "user tcp
client send thread" and tell it to close.
we use 'select' in "user tcp server thread",listening for incoming requests,
receiving and responding(sending) data.

*our doubt*
1、 ‘select’ can be used in multithread or not?  if yes, the first param
maxfdp1 of lwip_select() must be set to the total number of sockets in each
for example,in our situation, maxfdp1 = 2(clients) + 4(remote clients) +
1(listen socket) in each select?

2、is SYS_ARCH_PROTECT must be used in multithread? 

3、if lwip 1.4.1 does not support the multithread select mode,  does lwip
2.0.0 supports it? 

Thanks a  lot !

View this message in context: http://lwip.100.n7.nabble.com/LwIP-multithread-select-mode-problems-tp26561.html
Sent from the lwip-users mailing list archive at Nabble.com.

lwip-users mailing list
lwip-users <at> nongnu.org
Gennaro Zazo | 21 Jun 17:53 2016

lwip+gprs+ppp over serial

Hi guys,

I'm really sorry but after 10 days spent with lwip stack, it's time to ask help.
I'm working with a custom board based on stm32f103 and on ublox Leon-G100.

My first attempt was to connect the board trough the serial with pc and use pppd to connect. the test was successfully passed, I got with a speed test (console version) 8-14KBytes/s. The firmware was a simple pass-trough between two uarts. pc<->board<->gprs

After that I started to work with lwip to test with a small stack directly on board. I read that article http://lwip.wikia.com/wiki/PPP and honestly after 5-6 hours of work I got the first result, the board was successfully connected to the apn, I got the ip,gateway and mask but after that, no more progress come :P

Basically I initialize the modem and put it in data mode, then I call pd = pppOverSerialOpen(PPP_SERIAL_PORT, linkStatusCB, &connected); to link up the connection and it goes well. At this point I declare a socket and try to open a connection, in this way:

                /* set up address to connect to */
memset(&addr, 0, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = PP_HTONS(80);
addr.sin_addr.s_addr = inet_addr("");
int timeout = 10000;

/* create the socket */
s = lwip_socket(AF_INET, SOCK_STREAM, 0);
LWIP_ASSERT("s >= 0", s >= 0);

                /* first try blocking: */
/* connect */
ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr));
/* should have an error: "inprogress" */
LWIP_ASSERT("ret == -1", ret == -1);

the stack try to send a ppp request, 48 bytes well formatted, but no one byte is never received from uart.

I did a lot of tests playing with some parameters but no one of them went well. I don't want annoying you with all kind of tests I did. And yes, if you are asking if the modem is still in data mode after pppOverSerialOpen.  

Attached the log, I apologize if it is rude. If you need to change the debug mask let me know.

All your help will be appreciated.


Sending cmd:AT
Sending cmd:AT
Received response:OK
Sending cmd:AT
Received response:OK
Sending cmd:AT
Received response:OK
Sending cmd:ATE0
Received response:OK
Sending cmd:AT&K0
Received response:OK
Sending cmd:AT+CGATT=1
Sending cmd:AT+CGATT=1
Received response:OK
Sending cmd:AT+CGDCONT=1,"IP","internet.wind","",0,0
Received response:OK
Sending cmd:ATD*99***1#
Received response:CONNECT
lcp_init: xmit_accm=0 0 0 0
upap_init: 0
pppOverSerialOpen: unit 0: Connecting
pppStart: unit 0
ppp_set_xaccm[0]: outACCM=0 0 0 0
ppp_send_config[0]: outACCM=FF FF FF FF
ppp_recv_config[0]: inACCM=0 0 0 0
lcp_lowerup: asyncmap=0 0 0 0
LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED)
auth_reset: 0
lcp_addci: L opt=2 0
lcp_addci: L opt=5 34DE8CCF
lcp_addci: opt=7
lcp_addci: opt=8
pppWrite[0]: len=45
fsm_sdata(LCP): Sent code 1,1,20.
LCP: sending Configure-Request, id 1
LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT)
pppStart: finished
pppInProc[0]: got 7 bytes
pppInProc[0]: got 26 bytes
pppInProc[0]: got 28 bytes
pppInPropppInput[0]:0]: LCP len LCP len=20
fsm_rconfreLCP): Rcvd q(LCP): Rcvdid 1 state= id 1 state=6 6 (LS_REQSENT)
lcp_reqci: returning CONFACK.
pppWrite[0]: len=46
fsm_sdata(LCP): Sent code 2,1,20.
pppInput[0]: packet processed
pppInput[0]: LCP len=20
fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT)
lcp_acki: Ack
ppp_send_config[0]: outACCM=0 0 0 0
ppp_recv_config[0]: inACCM=0 0 0 0
pppWrite[0]: len=16
fsm_sdata(LCP): Sent code 9,0,8.
link_established: unit 0; Lowering up all protocols...
upap_lowerup: init 0 clientstate s=0
IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED)
pppWrite[0]: len=30
fsm_sdata(IPCP): Sent code 1,1,22.
IPCP: sending Configure-Request, id 1pppInProc[0
pppIntesen state 2 (L state 2 (LSS_CLO
        SED) -> Proc[0]: go6 (LS_REQSENt 5 bytes
pppInput[0]: packet processed
pppInput[0]: LCP len=8
fsm_input(LCP): default:
pppInput[0]: packet processed
pppInProc[0]: got 11 bytes
pppInProc[0]: got 27 bytes
ppppInput[0]pInput[0]: I: IPCP len=PCP len=10
fsm_rconfreq(IPCP): Rcvd id 1 state=6 (LS_REQSENT)
ipcp_reqci: ADDR
ipcp_reqci: returning Configure-ACK
pppWrite[0]: len=18
fsm_sdata(IPCP): Sent code 2,1,10.
pppInput[0]: packet processed
pppInput[0]: IPCP len=22
fsm_rconfnakrej(IPCP): Rcvd id 1 state=8 (LS_ACKSENT)
local IP address
primary DNS address
secondary DNS address
pppWrite[0]: len=30
fsm_sdata(IPCP): Sent code 1,2,22.
IPCP: sending Configure-Request, id 2
pppInput[0]: packet processed
pppInProc[0]: got 7 bytes
pppInProc[0]: got 23 bytes
pppInput[0]: IPCP len=22
fsm_rconfack(IPCP): Rcvd id 2 state=8 (LS_ACKSENT)
np_up: 0 proto=21
np_up: maxconnect=0 idle_time_limit=0
ipcp: up
sifup: unit 0: linkStatusCB=0x80010ad errCode=0
ip_addr =
netmask =
dns1    =
dns2    =
local  IP address
remote IP address
primary   DNS address
secondary DNS address
pppInput[0]: packet processed
0wip_socket(PF_INET, SOCK_STREAM, 0) =
 port=80)32t(0, addr=
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
pppifOutput[0]: proto=0x21
lwip_connect(0) failed, err=-10
lwip_send(0, data=0x801ce90, size=881z, flags=0x0)
lwip_send(0) err=-10 written=0z
lwip_recvfrom(0, 0x2000c60c, 1024z, 0x0, ..)
lwip_recvfrom: top while sock->lastdata=0
lwip_recvfrom: netconn_recv err=-10, netbuf=0
lwip_recvfrom(0): buf == NULL, error is "Connection aborted."!
lwip-users mailing list
Tim King | 21 Jun 19:00 2016

[Free Webinar] Digital Power for Xilinx Zynq Free Webinar 12th July

ELMG Digital Power, a Xilinx Alliance Program member, is hosting a webinar on using the Xilinx Zynq SoC as a digital power platform


Hi ,

Digital Power on the Xilinx Zynq Webinar

As an electronics engineer, you will no doubt be switched on to ELMG Digital Power’s stellar reputation as specialists in FPGA and power electronics. This coming month, on Tuesday 12th July, they are offering you the opportunity to learn what they know about Digital Power using Xilinx Zynq SoC.

Join ELMG Digital Power (Members of the Xilinx Alliance Program) for their Zynq Digital Power Webinar and expand your knowledge and expertise by discovering:

  • What is important in digital power, including numeric precision and latency
  • How to design a compensator in the digital domain
  • Why you would use a FPGA for digital power and why the Zynq SoC in particular
  • Key issues in digital controllers in programmable logic, such as the serial-parallel trade-off, fixed or floating point, choosing sample rates and what precision to use
  • The building blocks for digital control and ELMG’s licensable IP cores
  • IIR digital filter design (a case study) along with understanding the delta operator
  • Using the ARM cores in the Zynq to your full advantage.

The webinar will be hosted and presented by Dr. Tim King, ELMG Digital Power’s Principal FPGA Engineer. Tim has considerable experience the design and implementation of varied digital control systems and IP for power electronics on FPGA platforms.

This exciting opportunity is free and includes a short Q&A session with Dr. Tim King.

The webinar will be held on 12th July and is available globally. Just choose a time that best suits you from these three options:

  1. July 12th 2016 – commencing at 4pm in Christchurch NZ. (This will be 2pm Sydney, 1pm Tokyo, and 9:30am Delhi)



  1. July 12th 2016 - commencing at 9am London (10am Berlin)



  1. July 12th 2016 - commencing at 1pm San Francisco (3pm Houston, 4pm New York)






ELMG Ltd   Unit 3,  4 Knight Place, Addington  Christchurch ,  Canterbury   8041   New Zealand

You received this email because you are subscribed to Marketing Information from ELMG Ltd.

Update your email preferences to choose the types of emails you receive.

 Unsubscribe from all future emails 

<at> media print{#_hs { background-image: url('http://info.elmgdigitalpower.com/e1t/o/*VBRZgS8QZMMMW3NLyn47V54pV0/*W1XnddK1gQ3HFW6M41kW9bHwd30/5/f18dQhb0S6Hd5gnnPSN6-kkZGHzjKSW4VPyJV62RTlLW2mp9f_4-tC2kW4Pw4J12sbPxnW14nTqY4rxNJdW3T2zRD6tMMbYW3sqhx_3srYfRW2Gm4xd5x6QZZW4Bz6w35MGqpQMH39GhtLTx_W4F1CvP2KyPywW20Jy5J6nC2NlV1nxcB4wsRnM103');}} div.OutlookMessageHeader {background-image:url('http://info.elmgdigitalpower.com/e1t/o/*VBRZgS8QZMMMW3NLyn47V54pV0/*W83NkYH60sZZBW5Z0YG56DvbkW0/5/f18dQhb0S6Hg5gq2JmN6-kkZGHzjKSW4VPyJV62RTncW5HQHpl3FsfphW4PFxqB5ZH4gdW448hL13QQv1WW4Lnrq13VNXm_W3srZqF3sNSRPW2-gwJ55qv4fvW7jwdBp6JHhvPW4gyK_M4LvxqrW43CWyP42MDggW51fjdK7t_dH_W70RWJ11D8Xmj101')} table.moz-email-headers-table {background-image:url('http://info.elmgdigitalpower.com/e1t/o/*VBRZgS8QZMMMW3NLyn47V54pV0/*W83NkYH60sZZBW5Z0YG56DvbkW0/5/f18dQhb0S6Hg5gq2JmN6-kkZGHzjKSW4VPyJV62RTncW5HQHpl3FsfphW4PFxqB5ZH4gdW448hL13QQv1WW4Lnrq13VNXm_W3srZqF3sNSRPW2-gwJ55qv4fvW7jwdBp6JHhvPW4gyK_M4LvxqrW43CWyP42MDggW51fjdK7t_dH_W70RWJ11D8Xmj101')} blockquote #_hs {background-image:url('http://info.elmgdigitalpower.com/e1t/o/*VBRZgS8QZMMMW3NLyn47V54pV0/*W83NkYH60sZZBW5Z0YG56DvbkW0/5/f18dQhb0S6Hg5gq2JmN6-kkZGHzjKSW4VPyJV62RTncW5HQHpl3FsfphW4PFxqB5ZH4gdW448hL13QQv1WW4Lnrq13VNXm_W3srZqF3sNSRPW2-gwJ55qv4fvW7jwdBp6JHhvPW4gyK_M4LvxqrW43CWyP42MDggW51fjdK7t_dH_W70RWJ11D8Xmj101')} #MailContainerBody #_hs {background-image:url('http://info.elmgdigitalpower.com/e1t/o/*VBRZgS8QZMMMW3NLyn47V54pV0/*W83NkYH60sZZBW5Z0YG56DvbkW0/5/f18dQhb0S6Hg5gq2JmN6-kkZGHzjKSW4VPyJV62RTncW5HQHpl3FsfphW4PFxqB5ZH4gdW448hL13QQv1WW4Lnrq13VNXm_W3srZqF3sNSRPW2-gwJ55qv4fvW7jwdBp6JHhvPW4gyK_M4LvxqrW43CWyP42MDggW51fjdK7t_dH_W70RWJ11D8Xmj101')}
lwip-users mailing list
Zhuoran Zhao | 19 Jun 05:34 2016

How does tcp backlog works?

Hi, all

For research purpose, I have integrated lwip stack into a discrete event OS simulator. I set up my experiments with one server and multiple clients, thus I think I may need the server hold several incoming connections in a backlog queue, and I configured related macros in lwipopts.h as below:

#define TCP_LISTEN_BACKLOG 1 //enable

However the server can only capture one incoming connections, with all the other clients stuck at function netconn_connect (I am using netconn APIs). 

Anyone knows how is the tcp backlog implemented in lwip? Besides the two macros, is there any other functions (such as timers for re-transmission) that are necessary for the correct functionality of tcp backlog? Any suggestions will be helpful. 

Zhuoran Zhao
Computer Engineering Research Center (CERC), University of Texas at Austin, 
Department of Electrical and Computer Engineering, University of Texas at Austin, 
Cellphone: (+1)512-751-1819
Email: zoranzhao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Skype: zhuoran.zhao

lwip-users mailing list
peter | 17 Jun 00:03 2016

Embedded lwIP application stops working after 4-5 days


I am working on an embedded application in which I use lwIP to 
periodically send HTTP packets to a webserver (as TCP packets). It works 
fine for 4-5 days and then suddenly stops working. I have enabled lwIP 
stats in my lwipopts.h and it is outputting lwIP status to the UART. I 
captured this output to a file and also used Wireshark to capture the 
Ethernet traffic.

In the lwIP log file, I see that around the time when it stops working, 
the fields "max" and "err" in the MEM UDP_PCB section contains the 
number 4294967295 (2^32 - 1) which is strange, since these fields are 0, 
1 or 2 in the long period where there is no problems. This indicates to 
me that some kind of overflow is happening in the memory allocated to 
lwIP? Or could it be something else?

In the Wireshark log, I can see that after my application is doing a 
HTTP POST, it usually gets a HTTP OK from the server as it is supposed 
to do. When things go wrong, this does not happen. After that, the 
router can no longer detect the microcontroller.

I originally posted a similar question on the TI-E2E Community since I 
am using the Texas Instruments TM4C129XL LaunchPad Evaluation Kit (which 
is an ARM Cortex M4F based microcontroller with Ethernet PHY and other 
stuff on board). I got some responses to my question -- including the 
suggestion that I turn off UDP in lwipopts.h. I cannot do that, since I 
am using DHCP.

This thread 
appears to be dead now, which is why I am writing to this mailing list.

By the way, I am using lwip-1.4.1 as supplied with TivaWare (TI's C 
library for the TM4C-series microcontrollers).

So, I am hoping that an experienced lwIP user or lwIP developer can 
explain the meaning of "max" and "err" in the MEM UDP_PCB section and 
what could cause the strange values in these fields. Hopefully that 
could lead to a solution.

Any help is very appreciated - thanks in advance :-)

Peter Haagerup.
Erkan Ersoy | 16 Jun 10:41 2016

FreeRtos lwip Thread stops

So my device uses lwip 8.2.3 and lwip 1.4.1. STM32F107

I have web server running and a thread connects a web site take down information parse it and sleep 250ms . And a thread blinks a led. Yesterday I left my device for testing and about 2 hours http client thread stopped wiyhout any error.
So i have 2 questions
- Why a thread stops?
- is it possible to make a thread that monitors other threads and if it stops starts it again or restarts the device. (or one after another if one fails).

Thank you
lwip-users mailing list
Sergio R. Caprile | 13 Jun 14:44 2016

Re: R: R: R: R: ping slow down

If you have no users in the net, you only get the traffic you want.
If you have users in the net, you have many frames to process and that 
reveals the problems you have in your device. If you are missing frames 
or having process delays, it is most likely to notice that when you have 
many frames to process.
If the problem were caused by your router, you'd see it on a wireshark 
capture. Besides, two hosts in the same net do not use the router to 
communicate; if it is bad behaving as a switch, you'd see it anyway if 
you capture the traffic at the proper places.
Don't move pins to see your device's timing, that may open a wormhole 
and the world could colapse. Stay on trial and error, it is the best 
engineering problem solving method.
Marco Veeneman | 10 Jun 22:24 2016

How to add varbinds to SNMP traps?


I'm currently using LwIP git master commit [0737cfb] and investigating to update to the latest master. I'm using the SNMP agent, including sending specific SNMP traps with varbinds.

I was checking the changes related to SNMP and in general it looks better than the 'old' implementation. But i have a question about the traps implementation in the current master:

In the 'old' implementation varbinds were added using the 'snmp_varbind_tail_add()' function call. How can i add varbinds to a specific trap in the 'new' implementation?


lwip-users mailing list