Quality RTOS & Embedded Software

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


Loading

FreeRTOS 7.0.0 : Suspending the timer task

Posted by mizer on June 30, 2011
Hi,
I'm using ver 7.0.0. And really like the new timer addition. Is there a way to directly suspend the timer task? Presently I test a 'flag' in the top of each timer callback function. And if the flag is set will call vTaskSuspend(NULL). Thereby suspending the timer task. I wonder if there is an alternative way?

If you're interested why I would want to do this read below (and feel free to comment on of course) :

In my project I sense an impending power fail with an interrupt. And signal the highest priority task in the system of such. The high priority task suspends all tasks except for one in particular. I do this by recording all task handles as they are created. And then calling vTaskSuspend and one by one suspending all the tasks except the high priority powerfail task and the one. The one task I want to keep alive happens to manage a flash file system which can gracefully exit what it is doing once it knows of the impending powerfail. There is enough time to do this - like 30ms. However the application most surely has some timers active. And their callback code is getting called. And I want it all to stop.

Any coments welcome.

RE: FreeRTOS 7.0.0 : Suspending the timer task

Posted by Richard on June 30, 2011
I have already opened a feature request to add a method of getting the handle to the idle task - so I don't forget to add the functionality into the next version. I can extend that to also include a method of obtaining the handle to the timer task. That does not help you in the immediate term though.

If you want to edit the code yourself, then you can find only line in the FreeRTOS/Source/Timers.c file that calls xTaskCreate(), and replace the last parameter which is currently NULL with the address of a task handle variable in the normal way. You can then make that a global variable (easy, but a bit dirty), or add in a function that returns the handle.

Regards.

RE: FreeRTOS 7.0.0 : Suspending the timer task

Posted by mizer on June 30, 2011
Okay. To be able to get at those handles would be useful in the future. Particularly the timer task handle. For now what I have is functional. As long as I (and others are!) disciplined enough to remember to include my 'suspend' code in the top of each timer callback function. I may go the edit route but will think about it for a bit. Thanks for your help!


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner