[En-Nut-Discussion] How to make "Ethernut Device registration" more save??

Dominik Schröder dominik.schroeder at bh-informativ.de
Fri Aug 13 08:06:54 CEST 2010


Ok, I`m using Nut version 4.9.6. I tried to change the while loop in
EmacReset like this:

outr(RSTC_MR, RSTC_KEY | (2 << RSTC_ERSTL_LSB));
 
    outr(RSTC_CR, RSTC_KEY | RSTC_EXTRST);
    while ((inr(RSTC_SR) & RSTC_NRSTL) == 0)
	{
		NutSleep(10);
	}
    outr(RSTC_MR, RSTC_KEY | rstcr_tmp);

Then I recompiled the whole software.
Unfortunately this brings no better result. The system hangs of like before,
if no Ethernet cable is connected.

Where do I have to insert the NutSleep?

Best regards

Dominik
 

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Ács Péter
Gesendet: Donnerstag, 12. August 2010 17:59
An: en-nut-discussion at egnite.de
Betreff: Re: [En-Nut-Discussion] How to make "Ethernut Device registration"
more save??

Hello,

> My problem is, when I disconnect the Ethernet cable and then put on the
> system, the hole system seems to hang of. I don`t get any debug prompts on
> UART. After some time my external Watchdog forces the system to reset and
so
> on and so on...
>
> If the system starts with an connected Ethernet cable, everything works
> fine.

The problem is in the arch/arm/dev/at91_emac.c driver: it uses a 
constant (EMAC_LINK_LOOPS) for timeout, and in the EmacReset function 
(in stable 4.8.7 version; in the current svn version the problem is in 
the probePhy function) polls the PHY for link status in a loop. As it 
doesn't give back control to other threads, the other threads won't get 
any chance to run, neither the thread responsible for watchdog handling.
A possible solution is to insert a NutSleep(10) there (10ms should be 
OK, I think, it works for me), but the correct solution would be the 
rewrite of the initialization of the driver (and maybe adding link 
status handling too, through ioctl call?).

-- 
with best regards,

Peter

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list