After a long time I am able to run multiple task at same priority. But not able to do multitasking for different priorities.
So can anybody tell me to do multitaking at different priorities or i have to do some changes in kernal.
here i am mentioning a situation…
Let us assume we have two tasks task1 and task2.Task1 has higher priority than task2.Initially my task1 is running but a delay call come and than i want to execute my task2.
At the same priority i am able to execute task2 but not at different prorities.
You’ll need to make sure that Task1 blocks on a kernel object (semaphore, mutex, event flag, queue, etc…) so Task1 will go to sleep, otherwise Task2 will never execute.
You certainly do not need to change the kernel. Task2 will run when task1 is suspended, e.g. by a delay, when waiting for a semaphore or an item to appear in a queue, etc. What does not work is if task1 only calls taskYIELD since the yield will only allow a switch to other tasks of equal or higher priority.
SleepMs() never blocks, it stays within the function for the requested amount of time, but during this time it uses maximum CPU processing time to execute your null loop. As it does not block it is ready to run, and as the highest priority task it will always be the task that is selected to run. In other words you are seeing the expected behaviour whereby the low priority task is starved of processing time by a higher priority task that never leaves the Ready/Running state.
If the higher priority task blocked then it would not consume CPU time and the lower priority task would execute. This is achieved by replacing the null loop with vTaskDelay() or vTaskDelayUntil().
I realised that and try vtaskdelay()function as u can see in my code but after using that no prints available.
So please u also check that code with vtaskdelay().
If you are using vTaskDelay then task2 will run. However was the delay really only for 10 ticks as shown by the commented out line in your program? Try a longer delay as this might not be enough time for the printf and its rs232 transmission to complete. Another possibility is that your configuration (see your FreeRTOSConfig.h) is not setting up enough heap space for the two tasks (try reversing the creation order of the two tasks and see if it makes any difference) or enough priority levels. Also try selecting pre-emptive multitasking if you haven’t done so already.
when i am not using vtaskdelay() i am able to run both tasks at same priority but when i use vtaskdelay() it m task2 is not executing.I also increase tick and reversing the task creation as u suggest but getting same result as earlier.
If Heap memory is less than last task will not create and i am using premptive scheduling.
I observe that when i call vtaskdelay() it will not go beyond portyield() which is a macro asm("SWI").
I am trying to execute my low priority task by halting high priority task.
For that i tried vtaskdelay and vtasksuspend functions but after calling them no task is working.
so plz tell me to suspend a task we have to only call vtasksuspend and ou next low priority task starts resume without any modification?
NOw i am able to run low priority task by delaying high priority task using vtaskdelay but my high priority task is not resuming after expire of delay period and after delay period my low priority task also not running.