0
0
FreeRTOSprogramming~5 mins

vTaskDelay() for periodic tasks in FreeRTOS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of vTaskDelay() in FreeRTOS?

vTaskDelay() pauses a task for a specified number of tick periods, allowing other tasks to run. It helps in creating delays or periodic behavior in tasks.

Click to reveal answer
beginner
How does vTaskDelay() help in creating periodic tasks?

By delaying a task for a fixed number of ticks, vTaskDelay() makes the task wait before running again, effectively creating a simple periodic execution pattern.

Click to reveal answer
intermediate
What is a limitation of using vTaskDelay() for periodic tasks?

vTaskDelay() delays relative to when the function is called, so small variations in execution time can cause drift in the task's period over time.

Click to reveal answer
intermediate
Which FreeRTOS function is better than vTaskDelay() for precise periodic tasks?

vTaskDelayUntil() is better because it delays a task until a fixed point in time, preventing drift and keeping the task period consistent.

Click to reveal answer
beginner
Example: What does this code do?<br>
TickType_t xLastWakeTime = xTaskGetTickCount();
vTaskDelay(100 / portTICK_PERIOD_MS);

This code delays the task for 100 milliseconds from the moment vTaskDelay() is called. It does not consider when the task last ran, so it may cause timing drift if used repeatedly for periodic tasks.

Click to reveal answer
What does vTaskDelay() do in FreeRTOS?
ADeletes a task
BImmediately resumes a task
CChanges task priority
DPauses a task for a fixed number of tick periods
Why might vTaskDelay() cause timing drift in periodic tasks?
ABecause it delays relative to when called, not a fixed time
BBecause it uses interrupts
CBecause it deletes the task after delay
DBecause it changes the system clock
Which function is better for precise periodic timing in FreeRTOS?
AvTaskDelayUntil()
BvTaskDelete()
CvTaskSuspend()
DvTaskResume()
If you want a task to run every 500 ms exactly, which is best?
AUse vTaskDelay() with 500 ms delay
BUse vTaskDelayUntil() with a 500 ms period
CUse vTaskDelete() after 500 ms
DUse vTaskSuspend() for 500 ms
What does portTICK_PERIOD_MS represent?
ATask priority level
BTicks per second
CMilliseconds per tick in FreeRTOS
DStack size of a task
Explain how vTaskDelay() works and why it might cause timing drift in periodic tasks.
Think about when the delay starts counting.
You got /4 concepts.
    Describe the difference between vTaskDelay() and vTaskDelayUntil() for periodic task scheduling.
    Consider how each function measures delay time.
    You got /4 concepts.