xTimerResetFromISR do not restart the timer period properly

I use the a periodical software timer that has period of 25 ms. Also I have an asynchronous interrupts which have to restart period of my timer (after the interrupt the next timer callback expected after 25 ms). But I have a problem: after the interrupt the next timer callback occur after random time, not my expected value (25 ms). What is wrong? Code sample for restart timer (in the interrupt) follow: void rtosStartDataPrdTimer() { portBASE_TYPE xHigherPriorityTaskWoken = pdTRUE;
xTimerResetFromISR(rtos_timers[xDataPrdInterval], &xHigherPriorityTaskWoken);
}

xTimerResetFromISR do not restart the timer period properly

Have you tried using the xHigherPriorityTaskWoken parameter to ensure the timer task runs straight away if reseting the timer resulted in the timer task becoming the higher priority ready task? You do that calling either portYIELDFROMISR( xHigherPriorityTaskWoken ) or portENDSWITCHINGISR( xHigherPriorityTaskWoken ) (depending on the port you are using) before exiting the ISR. Did you check the return value of xTimerResetFromISR() to ensure the call was successful? Regards.

xTimerResetFromISR do not restart the timer period properly

Absolutely, I check the return value of the xTimerResetFromISR() and it looks good. Since I use an ARM port of the FreeRTOS should I use the portYIELDWITHINAPI() function?

xTimerResetFromISR do not restart the timer period properly

Well FreeRTOS supports 8 different ‘ARM’ architectures, but on all of them portYIELDWITHINAPI() should not be used. It is not part of the published API, and not intended for use by application writers. You could use portYIELDFROMISR(). That would ensure any task unblocked by the ISR would get a chance to run immediately that the ISR returns (the ISR would return to it, rather than the interrupted task) if the unblocked task has a priority higher than or equal to the currently running task. Regards.

xTimerResetFromISR do not restart the timer period properly

Sorry for an inaccurate information. My chip is ATSAM4L (ARM Cortex-M4 core) but I didn’t find the portYIELDFROMISR() macro in my RTOS sources (I’ve got a 7.4.2 version). Where can I get this macro for my chip? P.S. IDE is IAR.

xTimerResetFromISR do not restart the timer period properly

In that version you will probably need to use portENDSWITCHINGISR(). Newer versions have both. Regards.

xTimerResetFromISR do not restart the timer period properly

Thanks a lot! I’ve used the portENDSWITCHINGISR() function and it looks like successful.