FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2014 Threads] xTimerResetFromISR do not restart the timer period properlyPosted by sminder on June 25, 2014 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 properlyPosted by rtel on June 25, 2014 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 properlyPosted by sminder on June 27, 2014 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 properlyPosted by rtel on June 27, 2014 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 properlyPosted by sminder on June 27, 2014 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 properlyPosted by rtel on June 27, 2014 In that version you will probably need to use portENDSWITCHINGISR(). Newer versions have both.
Regards.
xTimerResetFromISR do not restart the timer period properlyPosted by sminder on July 23, 2014 Thanks a lot! I've used the portENDSWITCHINGISR() function and it looks like successful.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|