Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

xTimerResetFromISR do not restart the timer period properly

Posted 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 properly

Posted 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 properly

Posted 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 properly

Posted 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 properly

Posted 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 properly

Posted 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 properly

Posted by sminder on July 23, 2014

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


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS