lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] tcpip_init(...) behavior when no Ethernet cableconnecte


From: Martin Persich
Subject: Re: [lwip-users] tcpip_init(...) behavior when no Ethernet cableconnected
Date: Mon, 21 Jun 2010 18:16:01 +0200

Hi,
this is Atmel's bug, by my mind. The problem is in function "low_level_init()", module "ethernetif.c". This function waiting for ethernet driver initializing in part:
---------
  while( xMACBInit(&AVR32_MACB) == FALSE )
  {
    __asm__ __volatile__ ( "nop" );
  }
---------
I made many changes in "ethernet.c" and "macb.c" files to support starup LwIP stack with unconnected cable and restart of Auto-negotiation process if cable is reconnected.
I can send you my version of these files, if you want, but I haven't time for any additional comments in this moment.
 
Best Regards
Martin Persich
 
----- Original Message -----
Sent: Monday, June 21, 2010 4:26 PM
Subject: [lwip-users] tcpip_init(...) behavior when no Ethernet cableconnected

Hi,

I'm using Atmel (AVR32) suggestion on how to configure the lwip stack. Here is a code sample:


[thread]
...
sys_sem_t sem;
sem = sys_sem_new(0);

// Initialize the lwIP stack.
tcpip_init(TcpIpInitDone, &sem);

// Block until the lwIP stack is initialized.
sys_sem_wait(sem);
...



// Callback executed when the TCP/IP init is done.
static void TcpIpInitDone(void *arg)
{
    sys_sem_t *sem;
    sem = (sys_sem_t *)arg;

    // Signal the waiting thread that the TCP/IP init is done.
    sys_sem_signal(*sem);
}




This is to be sure that the initialization is done when the function returns, because it's a multithread project using RTOS. So, when my network cable is connected, everything is fine. When it is not connected. I never unblock from the semaphore until I connect one. This is a little problematic for me since at that moment, my watchdog is active (and must be), so I get constant resets.

I know I can probably change my code to make this work, but I was curious to know if  there was a way to start the stack without a cable, successfully and be in a state like if I had a cable and I disconnected it after startup. At flag maybe, or another method?

Thanks a lot,
Dany

reply via email to

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