[Top][All Lists]

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

[lwip-users] lwIP in eCos, PPP over GPRS connection problem

From: Marko Repo
Subject: [lwip-users] lwIP in eCos, PPP over GPRS connection problem
Date: Tue, 02 Aug 2005 16:06:01 +0300
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hello everybody,

I have confronted an inherently difficult problem to which I've been
unable to find an answer, despite of hard trying. Since
I don't yet have much experience in this field and it's not impossible
that I've got something terribly wrong, I decided to ask
for some hints.

The project I'm working on is a weather measurement application embedded
into a device that is supposed to gather data,
buffer it and send the collected data forward to the data server over
GPRS around the clock, 24/7.

So, in principle the data connection should be always up, but there's a
time window of about ten minutes reserved daily for
maintenance purposes -- restarting GSM connection, GPS module and in
general every other component that can be restarted
without drastic effects on data gathering -- during this period no data
is being send to or from the data server. Additionally,
the application should be always aware of the network status and be able
to survive from breaks which might occassionally
occur in network connection without any actual losses in the collected
weather data. I've written two simple functions described
below to open and close the PPP connection when necessary:

void lwip_ppp_shutdown()
   if(lwip_state == LWIP_UP){
       core_println("ppp", "Shutting down ppp pd%d", ecos_ppp_pd);
       core_println("ppp", "Connection already down!!!");

int lwip_ppp_restart()
   if(lwip_state == LWIP_UP)
       core_println("ppp", "Connection already established!!!");
       core_println("ppp", "Restarting PPP...");
       pppSetAuth(PPPAUTHTYPE_PAP, ppp_u, ppp_p);
       ecos_ppp_pd = pppOpen(sio_open(2), pppMyCallback, NULL);
       core_println("ppp", "New ppp pd %d", ecos_ppp_pd);
   return ecos_ppp_pd;

The problem is now that for some reason PPP fails to build up connection
more than once. Connection is built reliably
during lwip_init( ) every time. However, after I call pppClose( ) -
function for the first time I'm unable to reconnect anymore,
and since hard boot is out of question, I'm running out of ideas how to
restore the connection. Lwip_init is probably meant to
be run only once.

The critical parts in my initialization function look like this:

lwip_init(char* p3_u, char* p3_p)
   sys_init();    /* eCos specific initialization */
   mem_init();    /* heap based memory allocator */
   memp_init();    /* pool based memory allocator */
   pbuf_init();    /* packet buffer allocator */
   netif_init();    /* netif layer */

   /* Start the stack.It will spawn a new dedicated thread */
   sem = sys_sem_new(0);
   pppSetAuth(PPPAUTHTYPE_PAP, ppp_u, ppp_p);
   ecos_ppp_pd = pppOpen(sio_open(2), pppMyCallback, NULL);
   return ecos_ppp_pd;

I've ended up in the conclusion that there must be something wrong with
either LCP or IPCP when
trying to restart PPP connection after it has once been in dead phase.
Maybe I'm doing something wrong
during opening the connection (pppOpen) or I've forgot to initialize
something? I think I'm not supposed
to mess straight with lcp_, ipcp_ and fsm_ functions? I've spent many
long hours experimenting with the code,
without notable success. I would be grateful for any possible advice.

Best regards,
   Marko Repo
   Helsinki, Finland

reply via email to

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