Task2 usually spends most of its time in sleep (xSemaphoreTake(wakeup, …)). If Task1 detects an external event it needs to inform Task2 about it as soon as possible. So it obviously calls xSemaphoreGive(wakeup). (wakeup is a binary semaphore created by Task2)
The symptom is that Task2 doesn’t wake up till the timeout in xSemaphoreTake expires.
If Task1 and Task2 are on the same priority, this wakeup mechanism works like a charm.
The conclusion is that a lower priority task can’t wake up (at least with xSemaphoreGive) a higher priority task.
What am I doing wrong? Is it somehow possible to let a lower priority task wake up a higher priority one? Shall I use anything other than binary semaphores? Is my design wrong?
Task1 and Task2 should see the same handle, since if I modify their priority to be the same, it begins working as expected.
There may be some other problem in my program… There’s also a Task3 having the highest priority of all tasks, and Task1 can wake it up without any problem.