[En-Nut-Discussion] Strange problem...

Marek Pavlu pavlu at HWserver.cz
Sat Feb 25 15:07:11 CET 2006


Hi Harald, 

I have some problem in my application with hangs NicRx thread:(. 
I use ICMP protocol for sending ping and if I sending them faster or device
is on fully occupied segment of site or combination previous then thread
NicRx work fine, but sometime NicRx hangs in NutEventWait in this thread and
ignore all irq from RTL(NutEventPostFromIrq in NicInterrupt)...

If happen this then my application always work fine without incoming
ethernet packets, I alway can sending ping, always I have enough heap memory
and timing of my threads is intact, but incoming packets is lost:(((.

I use patch from Dusan Ferbas, which he here introduce in January. 
His patch improve situation, but not solve my problem complete:(. 

I do not know, why it is happen, but I use following code for discover this
situation. In nicrtl.c: 

----------------------------------------------------- 
//Global variable in nicrtl.c: 

unsigned int ignored_irqs = 0; 


//in interrupt from RTL 
static void NicInterrupt(void *arg) 
{ 
... 
ignored_irqs++; 
NutEventPostFromIrq(&ni->ni_rx_rdy); 
.... 
} 


// and in thread for reading packet from RTL 
THREAD(NicRx, arg) 
{ 
... 
NutEventWait(&ni->ni_rx_rdy, 0); 

NutEnterCritical(); 
ignored_irqs = 0; 
NutExitCritical(); 

... 


do { 

... 

NutEnterCritical(); 
ignored_irqs = 0; 
NutExitCritical(); 

... 

} while ... 

} 
----------------------------------------------------- 
In app. : 


THREAD(THSentinel, arg) 
{ 
        Unsigned                char state = 0; 
        Unsignedint             num_of_irq_ignored_0 = 0, 
                        num_of_irq_ignored_1 = 0; 
        extern volatile unsigned int ignored_irqs; 
        while(1) 
        { 
                NutSleep(1000); 

                switch(state) 
                { 
                case 0: 
                        NutEnterCritical(); 
                        num_of_irq_ignored_0 = ignored_irqs; 
                        NutExitCritical(); 

                        if(num_of_irq_ignored_0 > 0) state ++; 
                        break; 

                case 1: 
                        NutEnterCritical(); 
                        num_of_irq_ignored_1 = ignored_irqs; 
                        NutExitCritical(); 
                        if (    num_of_irq_ignored_1 > num_of_irq_ignored_0
&&\ 
                                num_of_irq_ignored_1 > 10) 
                        { 
                                state++; 
                        
                                // store number of NicRx hangs in eeprom... 
                                // gBoardDatap->wdog_app.NumOfNetDead++; 
                                // eeprom_save(); 
                                // or send character to UART... 
                        } 
                        break; 
                default: 
                        //MCU_REBOOT(0); 
                        break; 
                } 
        } 
} 



  _____  

avast! Antivirus <http://www.avast.com>  : Odchozi zprava cista. 


Virova databaze (VPS): 0608-1, 23.02.2006
Testovano: 25.2.2006 15:07:11
avast! - copyright (c) 2000-2003 ALWIL Software.






More information about the En-Nut-Discussion mailing list