Console Serial Debug Output Blocking

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Console Serial Debug Output Blocking

632 Views
tom_orsi
Contributor I

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

Labels (1)
Tags (2)
0 Kudos
1 Reply

522 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

 

Sorry for the delay, I was checking this section of the code and the odd behavior would be caused because

UART_GetStatusFlag(UART_Type *base, uint32_t flag); Is expecting to receive the UART_Type and the flag to be checked, this function is used to get the current status of specific UART status flag(including interrupt flag). The available status flag can be select from ref uart_status_flag_t enumeration. While kUART_AllInterruptsEnable, is part of the _uart_interrupt_enable which contains the settings for all of the UART interrupt configurations.

 

Could you please let me know which toolchain/IDE are you using?

 

Thank you,

Best regards,

Aldo.

0 Kudos