[En-Nut-Discussion] AT91SAM7X-EK, UART messing up the NutSleep

Albert Andras alandras at linetron.ro
Tue Jul 25 10:53:47 CEST 2006


From: "Harald Kipp" <harald.kipp at egnite.de>
> Anyway, what puzzles me is the relatively large deviation in Jix'
> test case.


"(10)start=0, stop=10  --> 10"
That's around 27 bytes message, it takes 2,3 ms to send at 115200

Andras.

----- Original Message ----- 
From: "Harald Kipp" <harald.kipp at egnite.de>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Tuesday, July 25, 2006 10:19 AM
Subject: Re: [En-Nut-Discussion] AT91SAM7X-EK, UART messing up the NutSleep


> Andras,
>
> Looks like the correct fix to me too. Except, further down
>
>         if (flags & TM_ONESHOT) {
>             tn->tn_ticks = 0;
>         } else {
>             tn->tn_ticks = tn->tn_ticks_left;
>         }
>
> needs to be replaced by
>
>         if (flags & TM_ONESHOT) {
>             tn->tn_ticks = 0;
>         } else {
>             tn->tn_ticks = ticks;
>         }
>
> Otherwise periodic timer intervals would be too short.
>
> Anyway, what puzzles me is the relatively large deviation in Jix'
> test case.
>
> Harald
>
>
> At 16:22 24.07.2006 +0300, you wrote:
>>Hi,
>>
>>As I can see the problem is that when you create a new timer for 
>>NutSleep()
>>NutTimerProcessElapsed is not up to date with nut_ticks_resume holding a 
>>value 3-4 timer tick smaller than actual time.
>>That's why when doing first NutTimerProcessElapsed SleepTimer is 
>>decremented with time elapsed from last processing, and not time from 
>>creation.
>>Probably there are simple work around, but maybe the timer creating should 
>>take care of the difference between nut_ticks_resume and 
>>NutGetTickCount().
>>Should be nut_ticks_resume global for this?
>>
>>For example:
>>
>>NUTTIMERINFO * NutTimerCreate(u_long ticks, void (*callback) (HANDLE, void 
>>*), void *arg, u_char flags)
>>{
>>    NUTTIMERINFO *tn;
>>
>>    tn = NutHeapAlloc(sizeof(NUTTIMERINFO));
>>    if (tn) {
>>        tn->tn_ticks_left = ticks+NutGetTickCount()-nut_ticks_resume;
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
> !DSPAM:44c5c52c316271767662257!
>
> 




More information about the En-Nut-Discussion mailing list