Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ovrscout

Pages: [1]
1
µTasker general / Re: hardware globar timer retriger problem
« on: May 16, 2011, 01:47:33 PM »
Hi, Mark

I am sorry about no further support of HW timer, it is easier solution for my project.
I do not need high accuracy of PITs or DMA. I need only few timeout timers about 3-7msec, with miliseconds precision.So instead of use small system tick I use global HW Timer.
Howerver, I thank you for your advice and quick response.I wil try PIT timer in future :)

P.S. It would be nice if any notice about obsolete status for HW global timer will be added to document "µTasker Global Software and Hardware timers" and/or to Source code/Header file

Best regards

2
µTasker general / hardware global timer retrigger problem
« on: May 16, 2011, 12:28:14 PM »
Hi,
   i have problem with use multiple hardware timer, i get timer event for timer which is  already retrigered.

Version is uTasker 1.4 for M5223X

Here is simplified example:
Code: [Select]
//this task is automaticaly called every 100ms
extern void fnMyLedControlTask(TTASKTABLE *ptrTaskTable)
{static int FirstInit=0;
 if (FirstInit==0)//Only be proceed on first run
{
FirstInit=1;
uTaskerGlobalMonoTimer((UTASK_TASK)(TASK_MY_TIMEOUT_CHECK | HARDWARE_TIMER),(550*MILISEC),E_TIMEOUT_TEST);
}
uTaskerGlobalMonoTimer((UTASK_TASK)(TASK_MY_TIMEOUT_CHECK | HARDWARE_TIMER),(550*MILISEC),TIMEOUT_CHECK_WD_LED_CONTROL);
 return ;
}
What i expect is that E_TIMEOUT_TEST will be called once and TIMEOUT_CHECK_WD_LED_CONTROL will never be called(because is retrigered every 100msec).
What i see is that both events is called:TIMEOUT_CHECK_WD_LED_CONTROL first and then E_TIMEOUT_TEST.

Note:The same code works well with SW timer

After some examination, i think that problem is in fnSetNewHWTimer function "GlobalTImer.c"
When another timer is running(with less or the same DelayTime) the actualy added timer  variable is set to
Code: [Select]
ptrNewTimer->TimerDelay=(requestedDelay-CurrentHwTimerRemainingTime);I think the right formula my be:
Code: [Select]
ptrNewTimer->TimerDelay=ActualHWTime->TimerDelay+(requestedDelay-CurrentHwTimerRemainingTime);because when firing HW timer all timers has been decreased by FiredTimerActualHWTime->TimerDelay so for new(or retrigered value) there is need to add this value.

the dirty patch{i actualy used) is add Actualy running HW timer->TimerDelay to New->TimerDelay
like this:
Code: [Select]
+static TIMER_BLOCK *fnGetHWFired(void);
+
 // Start hardware timer or queue the new timer
 //
 static void fnSetNewHWTimer(TIMER_BLOCK *ptrNewTimer)                    // {5} stop and adjust if retriggering HW monostable timer which is next to fire on its own
{
    CLOCK_LIMIT adjusted;
    uDisable_Interrupt();
    if (fnCheckHWFirst(ptrNewTimer) != 0) {                              // if we are adjusting the active HW timer that would fire as next, and alone
      ........
    }
     else {
-        uEnable_Interrupt();
+        TIMER_BLOCK  *ptrFirstFired=0;
+        uEnable_Interrupt();        
+        ptrFirstFired=fnGetHWFired();
+        ptrNewTimer->TimerDelay+=ptrFirstFired->TimerDelay;
     }
    adjusted = fnSetHardwareTimer(&ptrNewTimer->TimerDelay);
    ....
}

But i am not sure if this is correct.
Maybe also value which is compared in fnCheckHWFirst should be adjusted in some way.

P.S. I am sorry for my bad english

Pages: [1]