FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2013 Threads] Simple example programPosted by nagaraju on August 6, 2013 Hi ,
I have created the two tasks of equal ptiority like below.
xTaskCreate( vTask2, "Task 2", 1000, NULL, 1, NULL ); xTaskCreate( vTask1, "Task 1", 1000, NULL, 1, NULL );
In my task1 defination just i am printing on to the console " i am in task1" and in my task2 defination i am printing on the console " i am in task2."
in my main i have created the two tasks and called the vTaskStartScheduler();
Then my console is showing the only "i am in task1" message continuously.I have never seen the message "i am in Task2."
Please suggest me why this is happening.
I am working on stellaris DK-LM3s9b96 board.
Thanks, Nagaraju
RE: Simple example programPosted by Richard on August 6, 2013 My first guess would be that printing to the console is using some kind of semi hosting or other mechanism that is taking a long time and generally messing up with the functioning of the MCU - especially if you are printing to the console continuously without the task ever going into the blocked state. I would suggest removing the console print functions are replacing them with a simple incrementing variable. For example: volatile unsigned long x = 0, y = 0;
void vTask1( void * pvParameters ) { for( ;; ) { x++; } }
void vTask1( void * pvParameters ) { for( ;; ) { y++; } }
Create both tasks, let the application run for a few seconds, then stop the application on the debugger and inspect x and y - as you are creating both tasks at the same priority both variables should have incremented. Note if you create the tasks at different priorities then only the higher priority task will run because the code above does not allow either task to enter the Blocked state. Regards.
RE: Simple example programPosted by nagaraju on August 6, 2013 I am compiling my FreeRTOS and application with gcc.i don't have flexibility to debug the application through the IDE. I tried the below .
1.i have assigned same priority to the both the tasks . i observed the message on the console for the forst created task only.
2.I commented the printf statement in the first created task, then i have not observed the console message for the second creted task.
3.I changed the priority of the second created task to high then i am able to see the console message for the created high priority task.
Please suggest or help me how can i ensure that both tasks are running simultaneously.
Thanks, Nagaraj
RE: Simple example programPosted by Richard on August 6, 2013 If you don't have a debugger then it will be difficult to support you, but the next thing I would suggest is checking that the tick interrupt is executing. If you don't have a debugger then you can create a tick hook function and have that toggle a GPIO pin, then check the pin is toggling at the expected frequency on a scope.
Regards.
RE: Simple example programPosted by nagaraju on August 6, 2013 Able to see the console messages by placing the below API in both the tasks.
vTaskDelay( 250 / portTICK_RATE_MS );
Regards,
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|