AnsweredAssumed Answered

FreeRTOS tasks..

Question asked by kovaliov.nikolaj on Apr 23, 2016
Latest reply on Apr 25, 2016 by FTITI.Walid
Good day,

If anyone tried to use FreeRTOS I have one question, why my task is not finished, and another task is started? Here is my code and log.


code:

void vDebug1(void *pvParameters)
{
     vTaskDelay( 100 / portTICK_RATE_MS );
     printf("\nstart debug task1!");
     
     for(;;)
     {
          printf("\nDebug task1");     
          vTaskDelay( 250 / portTICK_RATE_MS );
     }
}






void vDebug2(void *pvParameters)
{
     vTaskDelay( 200 / portTICK_RATE_MS );
     printf("\nstart debug task2!");
     
     for(;;)
     {
          printf("\nDebug task2");     
          vTaskDelay( 250 / portTICK_RATE_MS );
     }
}


void vLedBlinkBlue(void *pvParameters)
{
     
     vTaskDelay( 300 / portTICK_RATE_MS );
     printf("\nvLedBlinkBlue task!");
     
     for(;;)
     {


          STM_EVAL_LEDToggle(LED3);
          vTaskDelay( 1000 / portTICK_RATE_MS );
          printf("\nSTM_EVAL_LEDToggle LED1!");
     }
}


void vLedBlinkRed(void *pvParameters)
{
     vTaskDelay( 400 / portTICK_RATE_MS );
     printf("\nvLedBlinkRed task!");
     
     for(;;)
     {
          STM_EVAL_LEDToggle(LED4);
          vTaskDelay( 500 / portTICK_RATE_MS );
          printf("\nSTM_EVAL_LEDToggle LED2!");
     }
}


void vLedBlinkGreen(void *pvParameters)
{
     vTaskDelay( 500 / portTICK_RATE_MS );
     printf("\nvLedBlinkGreen task!");
     
     for(;;)
     {
          
          STM_EVAL_LEDToggle(LED5);
          vTaskDelay( 125 / portTICK_RATE_MS );
          printf("\nSTM_EVAL_LEDToggle LED3!");
     }
}


void vLedBlinkOrange(void *pvParameters)
{
     vTaskDelay( 600 / portTICK_RATE_MS );
     printf("\nvLedBlinkOrange task!");
     
     for(;;)
     {
          STM_EVAL_LEDToggle(LED6);
          vTaskDelay( 250 / portTICK_RATE_MS );
          printf("\nSTM_EVAL_LEDToggle LED4!");
     }
}

Debug log: 

Debug task1
STM_EVAL_LEDToggle LED4!
Debug task2
STM_EVAL_LEDToggle LED3!
STM_EVAL_LEDToggle LED1!
STM_EVAL_LEDToggle LED3!
Debug task1
STM_EVAL_LEDToggle LED4!
STM_EVAL_LEDToggle LED2!
Debug task2
STM_EVAL_LEDToggle LED3!
STM_EVAL_LEDToggle LED3!
Debug task1
STM_EVAL_LEDToggle LED4!
Debug task2
STM_EVAL_LEDToggle LED3!
STM_EVAL_LEDToggle LDebug task1ED3!
STM_EVAL_LEDToggle LED4!
STM_EVAL_LEDToggle LED2!
Debug task2
STM_EVAL_LEDToggle LED3!
Debug task1
STM_EVAL_LEDToggle LED3!
STM_EVAL_LEDToggle LED4!
Debug task2
STM_EVAL_LEDToggle LED3!

Outcomes