Setup NRF52840 with SDK 17.1
FreeRTOS tickless idle mode
When we call xTaskNotifyWait and then get the notification then function returns but the result of the function is an error instead of success.
We know the task is getting notified but don't know why xTaskNotifyWait is returning pdFAIL.
When not using tickless idle mode then this issue does not happen (we get pdPASS).
Why is tickless idle mode causing this issue and how can we fix?
See code example (we end up call xTaskNotifyFromISR)
It looks like in freertos -> task.c -> xTaskNotifyWait the value
BaseType_t xResult = xTaskNotifyWait(pdFALSE, ULONG_MAX, &ulNotifiedValue, pdMS_TO_TICKS(5000));
// .. less then a second later we call xTaskNotifyFromISR and the xTaskNotifyWait returns immediatley
// but xResult == pdFALSE / pdFAIL
//Here is the notify code
static void task_notify(uint32_t event)
{
bool in_isr = ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0);
/* Notify the task by setting the corresponding bit in the task's notification value. */
if (in_isr)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
UNUSED_RETURN_VALUE(xTaskNotifyFromISR(m_task, event, eSetBits, &xHigherPriorityTaskWoken));
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
else
{
UNUSED_RETURN_VALUE(xTaskNotify(m_task, event, eSetBits));
}
}