0
0
FreeRTOSprogramming~10 mins

Priority-based scheduling 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 create a task with priority 2.

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

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main(void) {
    // Setup code
    [1]();
    while(1) {}
}
Drag options to blanks, or click blank then click option'
AxTaskCreate
BvTaskSuspend
CvTaskDelay
DvTaskStartScheduler
Attempts:
3 left
💡 Hint
Common Mistakes
Calling xTaskCreate instead of starting the scheduler.
Forgetting to start the scheduler.
3fill in blank
hard

Fix the error in the task priority assignment.

FreeRTOS
xTaskCreate(taskFunction, "Task2", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
A-1
B5
CconfigMAX_PRIORITIES - 1
DconfigMAX_PRIORITIES
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative priority.
Using a priority equal to configMAX_PRIORITIES.
4fill in blank
hard

Fill both blanks to create a task and set its priority to 3.

FreeRTOS
xTaskCreate([1], "Task3", 1000, NULL, [2], NULL);
Drag options to blanks, or click blank then click option'
AtaskFunction3
BtaskFunction2
C1
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up function names.
Using wrong priority values.
5fill in blank
hard

Fill all three blanks to create a task with priority 4 and start the scheduler.

FreeRTOS
xTaskCreate([1], "Task4", 1000, NULL, [2], NULL);
[3]();
Drag options to blanks, or click blank then click option'
AtaskFunction4
B4
CvTaskStartScheduler
DtaskFunction1
Attempts:
3 left
💡 Hint
Common Mistakes
Not starting the scheduler after creating the task.
Using incorrect function names or priorities.