# Systick in interrupt using FreeRTOS

I need to count how many miliseconds does it take my interrupt to finish its service. Before I started using FreeRTOS, I just did something like this:

void HAL_GPIO_EXTI_Callback(void)
{
uint32_t diff;
start = HAL_GetTick();
// do anything
diff = HAL_GetTick() - start;
}


But when I started using FreeRTOS, HAL_GetTick value stopped changing, moreover Systick Interrupt do not work, so there is no chance to increase tick value. Any ideas what should I do to bring back Systick Handler working in interrupt or other solution so I will be able to measure time in interrupt?

• FreeRTOS may need to manage that interrupt itself. It should provide its own timing facilities; why not use them instead? – Brian Drummond Aug 18 '15 at 9:55
• I tried, but I think as long as it is an interrupt, not a task, it won't work properly. Or I missed something. – m0drzew Aug 18 '15 at 11:11
• I'm not sure how this would work in the context of an RTOS: Have you looked at DWT_CYCCNT? See also: stackoverflow.com/q/11530593 – Tut Aug 18 '15 at 11:17
• I haven't seen it yet. I'll check it out. – m0drzew Aug 18 '15 at 11:43
• Your interrupt process time is in milliseconds? What are you doing inside an interrupt subroutine? You should use a hardware timer start it at the start of the interrupt subroutine and stop it at the end. You should be able to take measures in microseconds even in nanoseconds if required. – ECO Aug 18 '15 at 17:19