The console serial output implemented in fsl_debug_console.c and used via the PRINTF c-preprocessor macros seems to be blocking. The blocking seems to occur during the uart write, we determine this by seeing only a partial log message appearing on the console, a pause and then logging continues within 5 to 30 seconds.
The source code seems to support NON BLOCKING uart writes using the following CPP MACROS:
- DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
- DEBUG_CONSOLE_TX_RELIABLE_ENABLE=1
But using these macro produces the following compile time error:
/home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c: In function 'HAL_UartInterruptHandle':
/home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:165:14: error: too few arguments to function 'UART_GetStatusFlag'
status = UART_GetStatusFlag(s_UartAdapterBase[instance]);
^~~~~~~~~~~~~~~~~~
In file included from /home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:10:
/home/torsi/projects/M4-FREERTOS/freertos/devices/MIMX8MM6/drivers/fsl_uart.h:373:6: note: declared here
bool UART_GetStatusFlag(UART_Type *base, uint32_t flag);
^~~~~~~~~~~~~~~~~~
I made a guess at the fix but adding this seems to prevent any logging from occurring:
<<status = UART_GetStatusFlag(s_UartAdapterBase[instance]);
>>status = UART_GetStatusFlag(s_UartAdapterBase[instance], kUART_AllInterruptsEnable);
We are also considering just doing our own mutex protection around the console debug writes, assuming maybe the problem is that two or more tasks are hitting the writes at the same time and causing an issue.
Any help would be much appreciated.
Tom