xTaskNotifyWait does not suspend the calling task, but returns immediately with timeout, although timeout is set to portMAX_DELAY.
This appeared recently and it is the first time I experience that. My application is 2 years old, always worked and remained unchanged. I just recompiled (updated toolchain) and → boom.
STMCubeMX, STMCudeIDE, STLINK debugger.
XTaskNotify doesn’t take a timeout parameter and isn’t defined to block for anything. What makes you think it should?
If the notified task has a higher priority than the notifying task (and it was waiting for that notification) the system should switch to it, but otherwise xTaskNotify is SUPPOSED to just return and the task continue.
Perhaps something has previously notified the task and that notification is still pending? You may want to clear any pending notifications by first doing a wait with a 0 block time. Maybe you have a race condition.
I already do this. Stepping thru the FreeRTOS code shows there are no notifications pending. prvAddCurrentTaskToDelayedList is executed as well as vListInsertEnd therein. portYIELD_WITHIN_API(); is called thereafter. All looks fine, but xTaskNotifiyWait then proceedes and returns false.
Can you put a breakpoint at PendSV Handler and verify that the control switches to PendSV Handler when portYIELD_WITHIN_API(); is called? Is it possible that interrupts are disabled somehow? Do you have configASSERT defined?
You can also try disabling/commenting out parts of the functionality to find out the problematic part of code.
That does not seem okay and seems like a memory corruption. You can define a variable right next to uxCriticalNesting and set a data breakpoint on that. Chances are that that corruption is more than just uxCriticalNesting and you’ll be able to catch it right when it happens.
I still sometimes curse at not being able to program a dev board, only to later realise I hadn’t turned it on, especially if moving from hardware that took power from the debug interface.