2

I'm using FreeRTOs on Arduino for the first time. In my setup(), i would like to create my tasks but i have few more configuration to do after so i would like to create my tasks but don't start the scheduler immediately. This is my code currently with xTaskCreate and vTaskScheduler, but my code start the task immediately when they are created :

   //Create Tasks
   s1 = xTaskCreate(TaskAcquisition, NULL, configMINIMAL_STACK_SIZE, NULL, 2, &Acquisition);
   s2 = xTaskCreate(TaskStockage,NULL,configMINIMAL_STACK_SIZE + 200, NULL, 1, &Stockage);


.... Some more config


   Serial.println(F("Config finished"));

  //Check errors
  if(fifoData==NULL || fifoSpace == NULL || s1 != pdPASS || s2 != pdPASS){
  Serial.println(F("Creation error"));
  while(1);
  }
  Serial.println(F("Fifo and Tasks created"));

  //starting
  vTaskStartScheduler();

  //if the scheduler start the code don't came here
  Serial.println(F("Ram issue"));
  while(1);

Thanks for your help !

closed as off-topic by Chris Stratton, Code Gorilla, Michel Keijzers, Paul, user31481 Aug 18 '17 at 15:11

  • This question does not appear to be about Arduino, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I'm voting to close this question as off-topic because it is entirely about FreeRTOS, and not at all about the Arduino on which that is running. You really need to seek help in a FreeRTOS forum. – Chris Stratton Aug 18 '17 at 13:42
1

You need to vTaskSuspend the tasks immediately after creating them.

Then when you need a task to run you vTaskResume it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.