Running task from another task

Hi, 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

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

Running task from another task

Hi, 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