Bird
0
0

Identify the error in this ISR-to-task notification code snippet:

medium📝 Debug Q14 of 15
FreeRTOS - Task Notifications
Identify the error in this ISR-to-task notification code snippet:
void ISR_Handler() {
    vTaskNotifyGive(taskHandle);
}

void TaskFunction(void *pvParameters) {
    ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
    printf("Notified\n");
}
Aprintf() cannot be used in tasks
BMissing infinite loop in TaskFunction
CIncorrect parameter in ulTaskNotifyTake()
DUsing vTaskNotifyGive() inside ISR instead of vTaskNotifyGiveFromISR()
Step-by-Step Solution
Solution:
  1. Step 1: Check ISR notification function

    vTaskNotifyGive() is not safe inside ISR; must use vTaskNotifyGiveFromISR().
  2. Step 2: Verify task code correctness

    TaskFunction can have single call; infinite loop is common but not error here.
  3. Final Answer:

    Using vTaskNotifyGive() inside ISR instead of vTaskNotifyGiveFromISR() -> Option D
  4. Quick Check:

    ISR notification function must end with FromISR [OK]
Quick Trick: Use FromISR suffix functions inside ISRs [OK]
Common Mistakes:
  • Calling task functions inside ISR
  • Ignoring FromISR suffix importance
  • Assuming printf() is disallowed in tasks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes