[En-Nut-Discussion] (no subject)

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Sep 25 13:46:35 CEST 2012


In article <20120925103827.GB75560 at cicely7.cicely.de> you wrote:
> On Tue, Sep 25, 2012 at 11:32:06AM +0200, Uwe Bonnes wrote:
> > >>>>> "Michael" == Michael Jones  writes:
> > 
> > <proposal to make SLEEP_MODE_IDLE for AVR>
> > 
> > 
> >     Michael> I must strongly object, sleep mode, depending on the CPU, 
> > 
...
> > Please explain the impact of SLEEP_MODE_IDLE on AVR. In my understanding,
> > this will lower timing jitter after the wake-up event, as we always restart
> > execution after the line
...
> The default is there intentionaly - getting CPU sleeps right is a very
> tricky thing and can only be done if the developer has taken care
> of them.
> For example the  above code is missing the case that after calling
> NutThreadYield() an interrupt service sets a thread on the run queue
> before sleeping.
> In that case the thread won't get serviced until the next interrupt
> reeenables the CPU, which at worst case is the timer at IIRC 65ms in
> default configuration.
> I don't think that most developers want random 65ms jitter here.
> Either fix that race condition, which really isn't easy and probably
> even impossible with AVR, or leave the default as it is.
> For fixing the race completely you need hardware support, which AFAIK
> AVR has not.
> There are applications where this is not a problem, or non ethernut
> related use cases were those race conditions won't happen, but those
> are shurely not the standard case for ethernut users.

Okay, this brings us somehwere. 

While your 65 ms delay assumption is wrong, as the timer ticks at 1kHz, you
point out unexpected code behaviour. Even a 1ms delay may be
unwanted. Probably this can be seen in a ping example. Did anybody examine
that?

So I will leave the default, but add a configuration option. This allows me
to bring up boards and testcases with the HEARTBEAT Idle LED indicating the
board working without touching the code on a individual base.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the En-Nut-Discussion mailing list