Bird
0
0

You want a task to run every 200 ticks precisely using FreeRTOS. Which approach ensures this timing despite task execution time?

hard📝 Application Q15 of 15
FreeRTOS - RTOS Fundamentals
You want a task to run every 200 ticks precisely using FreeRTOS. Which approach ensures this timing despite task execution time?
AUse vTaskDelayUntil() with a previous wake time variable
BUse vTaskDelay(200) at the end of the task loop
CUse xTaskGetTickCount() inside the task and delay manually
DUse vTaskDelay(100) twice in the task loop
Step-by-Step Solution
Solution:
  1. Step 1: Understand vTaskDelay() limitation

    Using vTaskDelay(200) delays from current time, so task execution time adds up causing drift.
  2. Step 2: Use vTaskDelayUntil() for fixed periodic timing

    vTaskDelayUntil() uses a previous wake time to maintain exact periodic intervals regardless of execution time.
  3. Step 3: Evaluate other options

    Manual delay or multiple delays do not guarantee precise timing; only vTaskDelayUntil() does.
  4. Final Answer:

    Use vTaskDelayUntil() with a previous wake time variable -> Option A
  5. Quick Check:

    Precise periodic task = vTaskDelayUntil() [OK]
Quick Trick: Use vTaskDelayUntil() for exact periodic task timing [OK]
Common Mistakes:
  • Using vTaskDelay causes timing drift
  • Trying manual delay calculations
  • Ignoring task execution time in timing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes