0
0
FreeRTOSprogramming~10 mins

Hard real-time vs soft real-time in FreeRTOS - Interactive 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 that must meet a strict deadline (hard real-time).

FreeRTOS
xTaskCreate(taskFunction, "Task1", configMINIMAL_STACK_SIZE, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
AconfigMAX_PRIORITIES - 1
BtskIDLE_PRIORITY
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using low priority for hard real-time tasks.
Confusing priority values.
2fill in blank
medium

Complete the code to delay a soft real-time task without blocking other tasks.

FreeRTOS
vTaskDelay([1]);
Drag options to blanks, or click blank then click option'
A0
BpdMS_TO_TICKS(100)
C100
DportMAX_DELAY
Attempts:
3 left
💡 Hint
Common Mistakes
Passing raw milliseconds instead of ticks.
Using portMAX_DELAY which blocks indefinitely.
3fill in blank
hard

Fix the error in the code to ensure a hard real-time task does not miss its deadline.

FreeRTOS
if (xTaskGetTickCount() > [1]) {
    // handle deadline miss
}
Drag options to blanks, or click blank then click option'
AxTaskGetTickCount()
BportMAX_DELAY
CpdMS_TO_TICKS(1000)
Ddeadline
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing to portMAX_DELAY which is a constant for max delay.
Comparing to current tick count which is always true.
4fill in blank
hard

Fill both blanks to create a soft real-time task that waits for a notification with a timeout.

FreeRTOS
if (xTaskNotifyWait(0, 0, NULL, [1]) == [2]) {
    // notification received
}
Drag options to blanks, or click blank then click option'
ApdMS_TO_TICKS(5000)
BpdPASS
CportMAX_DELAY
DpdFAIL
Attempts:
3 left
💡 Hint
Common Mistakes
Using portMAX_DELAY which waits indefinitely.
Checking for pdFAIL instead of pdPASS.
5fill in blank
hard

Fill all three blanks to define a hard real-time task that suspends itself and resumes after an interrupt.

FreeRTOS
void [1](void *pvParameters) {
    for (;;) {
        vTaskSuspend(NULL);
        // task resumed by [2]
        [3]();
    }
}
Drag options to blanks, or click blank then click option'
AHardRealTimeTask
Ban ISR
CprocessCriticalData
DSoftRealTimeTask
Attempts:
3 left
💡 Hint
Common Mistakes
Using a soft real-time task name for a hard real-time task.
Not calling the processing function after resume.