Bird
0
0

Given this code snippet, what is the error?

medium📝 Debug Q14 of 15
FreeRTOS - Task Creation and Management
Given this code snippet, what is the error?
void TaskA(void *pvParameters) {
  while(1) {
    // Do something
    vTaskDelay(1000);
  }
}

xTaskCreate(TaskA, "TaskA", 1000, NULL, 1, NULL);
ATask function must return int, not void
BvTaskDelay requires delay in ticks, not milliseconds
CStack size 1000 is too small
DTask name must be longer than 5 characters
Step-by-Step Solution
Solution:
  1. Step 1: Check vTaskDelay parameter

    vTaskDelay expects delay in ticks, not milliseconds.
  2. Step 2: Identify correct delay usage

    Use pdMS_TO_TICKS(1000) to convert 1000 ms to ticks.
  3. Final Answer:

    vTaskDelay requires delay in ticks, not milliseconds -> Option B
  4. Quick Check:

    Delay unit must be ticks = vTaskDelay requires delay in ticks, not milliseconds [OK]
Quick Trick: Use pdMS_TO_TICKS() to convert ms to ticks for vTaskDelay [OK]
Common Mistakes:
  • Passing milliseconds directly to vTaskDelay
  • Wrong return type for task function
  • Incorrect stack size assumptions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes