0
0
FreeRTOSprogramming~10 mins

Preemptive scheduling behavior in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
vTaskStartScheduler[1];
Drag options to blanks, or click blank then click option'
A()
B{}
C[]
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the parentheses and writing just the function name.
Adding curly braces instead of parentheses.
2fill in blank
medium

Complete the code to create a task with priority 2.

FreeRTOS
xTaskCreate(TaskFunction, "Task1", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
A2
B1
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using priority 0 which is the lowest priority.
Confusing the stack size with priority.
3fill in blank
hard

Fix the error in the task delay function to yield control correctly.

FreeRTOS
vTaskDelay([1]);
Drag options to blanks, or click blank then click option'
AportTICK_PERIOD_MS
B1000
C1000 * portTICK_PERIOD_MS
D1000 / portTICK_PERIOD_MS
Attempts:
3 left
💡 Hint
Common Mistakes
Passing milliseconds directly without conversion.
Multiplying instead of dividing by portTICK_PERIOD_MS.
4fill in blank
hard

Fill both blanks to create a preemptive scheduler configuration.

FreeRTOS
configUSE_PREEMPTION = [1];
configMAX_PRIORITIES = [2];
Drag options to blanks, or click blank then click option'
A1
B0
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Setting configUSE_PREEMPTION to 0 disables preemption.
Choosing too few or too many priorities.
5fill in blank
hard

Fill all three blanks to correctly implement a task function that yields control.

FreeRTOS
void TaskFunction(void *pvParameters) {
    for(;;) {
        // Task code here
        [1]();
        [2](10 / [3]);
    }
}
Drag options to blanks, or click blank then click option'
AvTaskDelay
BvTaskDelayUntil
CportTICK_PERIOD_MS
DtaskYIELD
Attempts:
3 left
💡 Hint
Common Mistakes
Using vTaskDelayUntil without proper tick count variable.
Forgetting to convert milliseconds to ticks.