lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Missing initialization somewhere?


From: Sergey Kubushyn
Subject: [lwip-devel] Missing initialization somewhere?
Date: Wed, 12 Oct 2011 18:22:14 -0700 (PDT)
User-agent: Alpine 2.02 (LFD 1266 2009-07-14)

I'm fighting with a weird bug on Stellaris LM3S9B92 MCU (silicon rev.C5)
running lwIP latest (from git repository.)

Problem is definitely TCP-related. Here is what's going on:

MCU is reset, lwIP initialized, tcp_new(), tcp_bind(), tcp_listen(),
tcp_accept() are done. Sometimes (~50% cases) it works fine -- MCU accepts
the connection and can work for hours without a hitch accepting/closing
thousands of connections.

The problem is it does not happen on every reset. Something like half of
them result in a non-working system. On a connection attempt MCU sends ARP
for the remote on the first SYN packet received, gets a response and then
network is dead. No echo replies, no ARP requests/replies, nothing. It hangs
on the very first SYN so tcp_accept() callback is not called etc.

IP address is obtained via DHCP. Works all the time like a charm, no
problems. ICMP works all the time too, on each and every reset. If a remote
left constantly pinging and MCU is reset every 30 seconds or so replies stop
until it gets its IP from DHCP and restart once it is up. Works always, on
each and every reset, no problems whatsoever.

It also works all the time if I ping it right after reset before attempting
a TCP connect.

Only fails if first packets received are from TCP connection attempt. Not
every time that makes me think something is not initialized and it is
dependent on the MCU initial state that is random.

I'm able to trace it to as far as ip_route() from tcp_fragment_send() (or
whatever is called) when it attempts to send a SYN/ACK (that is properly
formatted) and ip_route() fails on netif_is_up() that returns 0 i.e. UP flag
is not set. From now on no network any more -- no ARPs, no ICMP replies,
nothing.

It never happens if the first packet received is ICMP echo request. After
one such packet (ICMP echo reply is sent out) everything works perfectly.

Any idea what might it be?

I'm pushed to try Keil TCP stack that I wouldn't rather do if I had a
choice...

---
******************************************************************
*  address@hidden    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************



reply via email to

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