ApplicationTickHook repeated calls - bug??

claytong wrote on Friday, April 21, 2006:

I have used the Tick Hook as a means to drive a multiplexed LED display. However I soon found that it was not calling my Mux routine consistantly - it was often double or even triple calling it.

I have tracked this down to the MissedTicks processing in xTaskResumeAll (tasks.c) - this is also resulting in an vApplicationTickHook call (via vTaskIncrementTick ). So vApplicationTickHook gets called with each tick ISR (regardless of a proper tick handling or a tick miss), and then again when tick misses are handled.

The fix I have put into place is to remove the vApplicationTickHook from vTaskIncrementTick (task.c) and instead put it into the vPortYieldFromTick call (port.c) - this does however mean that all portable code needs this change - I have just changed my GCC-AVR port which this project uses.

I’m sure a better solution that does not involve portable code can be implemented in the next release - assuming of course that you agreee that the current behaviour is not correct :slight_smile:

On further thinking maybe the current behaviour is valid if the hook is doing something based on the tick count. Maybe two hooks are needed - a ‘TickInterrupt’ hook and a ‘TickIncrement’ hook??

nobody wrote on Friday, April 21, 2006:

If its a periodic hook that is required then the best way would be to somehow prevent the hook being called when the function is called from xTaskResumeAll().  I cannot see a neat way of doing this without using a parameter which would not be desirable.

nobody wrote on Friday, April 21, 2006:

You can call tickHook directly from the tickISR -
take a look at the post from:

By: Nobody/Anonymous - nobody
  RE: Staggering Task Start Times
2005-12-16 04:26

You can find this by searching this forum for

John W.