So after hours of debugging the driver code and trying to understand all the preprocessor magic in the UART code I finally found the reason for this behaviour. And it is indeed not related to the FreeRTOS API!
The problem begins if you set a flag which is mentioned in the hello world example of the SDK:
"just define DEBUG_CONSOLE_TRANSFER_NON_BLOCKING in your project to use the advanced debug console utility."
I thought it is a good idea to do so, as a non-blocking console doesn't disturb the code timing so much. But this option has a catastrophic side effect which is not mentioned or documented anywhere:
The startup-code (startup_mimxrt1176_cm7.c) defines the LPUART IRQs as follows:
WEAK void LPUART10_IRQHandler(void) { LPUART10_DriverIRQHandler(); }
So the IRQs are routed to the LPUART driver which is fine.
But if you define DEBUG_CONSOLE_TRANSFER_NON_BLOCKING then the IRQs of ALL LPUARTS (and not only the IRQ of the console LPUART1) are overwritten in fsl_adapter_lpuart.c then:
void LPUART10_IRQHandler(void);
void LPUART10_IRQHandler(void)
#endif /* LP_FLEXCOMM10 */
{
HAL_UartInterruptHandle(10);
SDK_ISR_EXIT_BARRIER;
}
#endif
#endif /* LPUART10 */
and in HAL_UartInterruptHandle there's the line
hal_uart_state_t *uartHandle = s_UartState[instance];
which leads to an assertion afterwards if you're not using HAL_UartInit.
Or in other words: All your existing (non HAL_xxx) UART-Code will blow up, if you set DEBUG_CONSOLE_TRANSFER_NON_BLOCKING.
Please have a look in the driver code, this is really a bad, intrusive and malicious option which should have a BIG FAT WARNING if you're really using it.
In my opinion this definition should be killed from the SDK as it has so bad side effects. No wonder that none of the SDK exapmles is setting this option.
Unfortunately nobody answered some of my questions, so here once again:
1. For what reason is the HAL_Uartxxx-API (fsl_adapter_lpuart.c)? Why and when should I use it?
2. What is the difference between "utility_debug_console" and "utility_debug_console_lite"? The SDK documentation is the same for both components?
So please, do not point me again to the SDK documentation, I already read it and the "full description" doesn't mention any differences.
Bye,
Oliver