I have a task that I want to block until some data arrive from a serial port.
I have setup the serial port to trigger an interrupt every time a byte is received.
I want to notify a task to unblock and process the data.
I tried with ulTaskNotifyTake and vTaskNotifyGiveFromISR but the program seems to deadlock somewhere…
Any ideas?
PS: The drivers work, the serial port works and the interrupt can trigger. If I comment out vTaskNotifyGiveFromISR and portYIELD_FROM_ISR the led blinks. Otherwise the program seems to block forever…
EDIT: Just found out that portASSERT_IF_INTERRUPT_PRIORITY_INVALID()fails.
The code runs on Cortex-M4
My 1st guess configMINIMAL_STACK_SIZE is way too small (for a task using stack hungry printf-family functions).
2nd issue might be an incorrect interrupt priority. Edit: You also should check the return codes of xTaskCreate etc.
How do you ensure that interrupt is not fired before you set my_task_handle? If enable_serial_port() enables the UART interrupt, should you not change the definition to the following -