xTimerIsTimerActive returns pdFALSE even though timer is started

Hi,
I’m using a one shot timer which can be started during a the cycle of another periodic timer and individually.
During the one shot timer cycle im calling xTimerIsTimerActive and checking its returnvalue.
If I start the one shot timer w/o the periodic timer, a few times in a row, xTimerIsTimerActive returns as expected pdTRUE.

If I let it start during the cycle of the periodic Timer, the first cycle is as expected, but in all following cycles xTimerIsTimerActive returns pdFALSE.

Below, the function which starts the one shot timer, which can be called individually or during the periodic timer cycle:

uint8_t Proc_Run()
{

xTimerStart(Duration_Timer_Handle,portMAX_DELAY)
Proc_ExhaustValve_Set(TO_PORT);
pow17_l6480_cmd_move(pow17, PISTON_PULL, smDings.runSettings.pow17_steps);
osDelay(200);
while(xTimerIsTimerActive(Duration_Timer_Handle))
{
Proc_GetIO();
osDelay(10);
}
Proc_INIValve_Set(TO_EXHAUST);
osDelay(200);
return Proc_GoToRefPos_Do();
}

thanks for your help,

Pasqual

One thing you might try is to set configTIMER_TASK_PRIORITY higher than the priority of any of your tasks that use timers. See if that makes a difference.

Unfortunally that doesn’t help.

Is Duration_Timer_Handle the one-shot timer? What is its duration?

Do you mean “a few times in a row” through the 10-tick while() loop?

Do you mean the first call to xTimerIsTimerActive() returns pdTRUE, immediately after the 200-tick delay?

Is it possible the timer Duration_Timer_Handle has actually expired and everything is working as expected? If not, tell us why not.

Yes thats the one shot timer, with a duration of 3000ms.

I mean that I start the timer manually again when its expired for ten times. So it runs ten times through its 3000ms duration.

No, I also read out its duration before starting the timer again and its always 3000ms.

Thanks for your help.

You might try some asserts and then use the debugger to see what’s happening after you hit the assert. For example:

uint8_t Proc_Run()
{
   xTimerStart(Duration_Timer_Handle,portMAX_DELAY)
   configASSERT(xTimerIsTimerActive(Duration_Timer_Handle));    // ***NEW
   volatile TickType_t expiryTime = xTimerGetExpiryTime(Duration_Timer_Handle);  // ***NEW
   Proc_ExhaustValve_Set(TO_PORT);
   pow17_l6480_cmd_move(pow17, PISTON_PULL, smDings.runSettings.pow17_steps);
   osDelay(200);
   configASSERT(xTimerIsTimerActive(Duration_Timer_Handle));    // ***NEW
   while(xTimerIsTimerActive(Duration_Timer_Handle))
   {
      Proc_GetIO();
      osDelay(10);
   }
   Proc_INIValve_Set(TO_EXHAUST);
   osDelay(200);
   return Proc_GoToRefPos_Do();
}

Be sure the timer task’s priority is higher than this task for this testing code.