Bird
0
0

What is wrong with this task notification wait call?

medium📝 Debug Q7 of 15
FreeRTOS - Task Notifications
What is wrong with this task notification wait call?
uint32_t ulValue;
xTaskNotifyWait(0x01, 0x01, &ulValue, 1000);
AThe clear bits mask and wait bits mask are the same, causing immediate return
BThe timeout value must be portMAX_DELAY for notifications
CulValue pointer must be NULL if not interested in notification value
DThe function cannot be called with non-zero clear bits mask
Step-by-Step Solution
Solution:
  1. Step 1: Understand xTaskNotifyWait parameters

    Clear bits mask clears bits before waiting; wait bits mask specifies bits to wait for.
  2. Step 2: Analyze masks

    Using the same mask for clear and wait means bits are cleared before checking, causing immediate return.
  3. Final Answer:

    Clear and wait bits masks are the same, causing immediate return -> Option A
  4. Quick Check:

    Clear bits mask should differ from wait bits mask [OK]
Quick Trick: Don't clear bits you are waiting for in xTaskNotifyWait [OK]
Common Mistakes:
  • Using identical clear and wait bits masks
  • Assuming timeout must be portMAX_DELAY
  • Passing NULL pointer incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes