0
0
FreeRTOSprogramming~10 mins

Choosing priorities for real applications 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 set the highest priority for a critical task.

FreeRTOS
xTaskCreate(taskFunction, "Task1", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
AconfigMAX_PRIORITIES - 1
B0
C1
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the highest priority, which is actually the lowest.
Using a priority higher than configMAX_PRIORITIES - 1, which is invalid.
2fill in blank
medium

Complete the code to create a low priority background task.

FreeRTOS
xTaskCreate(backgroundTask, "BGTask", 500, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
A1
B0
CconfigMAX_PRIORITIES
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning a high priority to background tasks, which can block important tasks.
Using a priority value outside the allowed range.
3fill in blank
hard

Fix the error in setting task priority to avoid invalid priority assignment.

FreeRTOS
xTaskCreate(myTask, "MyTask", 256, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
AconfigMAX_PRIORITIES
B-1
CconfigMAX_PRIORITIES - 1
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using configMAX_PRIORITIES as a priority, which is out of range.
Using negative priority values.
4fill in blank
hard

Fill both blanks to create a medium priority task that runs periodically.

FreeRTOS
xTaskCreate([1], "PeriodicTask", 512, NULL, [2], NULL);
Drag options to blanks, or click blank then click option'
AperiodicTaskFunction
BconfigMAX_PRIORITIES - 1
C5
DidleTaskFunction
Attempts:
3 left
💡 Hint
Common Mistakes
Using the idle task function for a periodic task.
Assigning the highest priority to a periodic task unnecessarily.
5fill in blank
hard

Fill all three blanks to create a task with a custom stack size, priority, and name.

FreeRTOS
xTaskCreate([1], [2], [3], NULL, 3, NULL);
Drag options to blanks, or click blank then click option'
AcustomTaskFunction
B"CustomTask"
C1024
D"DefaultTask"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number instead of a string for the task name.
Mixing up the order of arguments.