Quality RTOS & Embedded Software

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


Running task from another task

Posted by bkpatel on July 14, 2015


I am trying to implement following scenarios, if any guide to achieve this will be helpful.

  • Before starting scheduler, I have created 4 tasks, one timer and one interrupt
  • By default all task should not be running, somewhere I read this can be managed by assigning -ve priority to the task. Is it correct implementation?
  • Whenever timer expires it checks for condition and makes certain task ready for execution (means changing the priority of tasks at run time)
  • when the task is completed task itself change the priority to -ve again. Above three are true if -ve priorities can be assigned, if not what is other method to achieve?

  • If interrupt is occurring than system has to log some points in memory and than resets

  • If system is hanged and none of the task or timer or interrupt is able to execute for some time than system has to reset.

Thanks, Bhavesh

Running task from another task

Posted by rtel on July 14, 2015

You cannot use a negative priority.

If you want to create a task before the scheduler has started, but don't want the task to run, then create the task with xTaskCreate(), using the pvCreatedTask to obtain the task's handle, then use the handle in a call to vTaskSuspend(). It is ok to do that before the scheduler has started, and means the tasks will be suspended when the scheduler starts.

To make a task ready for execution you can then use vTaskResume() in a software timer, or xTaskResumeFromISR() from an interrupt. You have to be careful doing that though - see the API documentation for xTaskResumeFromISR() for the reason why.

If you want to detect the system is hanging then you can have each task maintain a counter, then use a higher priority task to monitor all the counters to ensure they are still counting and not stalled. Most of the standard demo applications provided with FreeRTOS do that.


Running task from another task

Posted by bkpatel on July 14, 2015


Thanks for suggestion and I have tested the same on POC with 1 timer and 1 task. I will update thread if find any difficulty in case of multiple tasks.

Thanks, Bhavesh

[ 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.


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


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