Simple example program

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

Simple example program

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.

Simple example program

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

Simple example program

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.

Simple example program

Able to see the console messages by placing the below API in both the tasks. vTaskDelay( 250 / portTICK_RATE_MS ); Regards,