Quality RTOS & Embedded Software

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


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists