<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Console Serial Debug Output Blocking in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Console-Serial-Debug-Output-Blocking/m-p/934827#M140077</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The source code seems to support NON BLOCKING uart writes using the following CPP MACROS:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;DEBUG_CONSOLE_TRANSFER_NON_BLOCKING&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt; DEBUG_CONSOLE_TX_RELIABLE_ENABLE=1&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But using these macro produces the following compile time error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c: In function 'HAL_UartInterruptHandle':&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;/home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:165:14: error: too few arguments to function 'UART_GetStatusFlag'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; status = UART_GetStatusFlag(s_UartAdapterBase[instance]);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; ^~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;In file included from /home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:10:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;/home/torsi/projects/M4-FREERTOS/freertos/devices/MIMX8MM6/drivers/fsl_uart.h:373:6: note: declared here&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; bool UART_GetStatusFlag(UART_Type *base, uint32_t flag);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; ^~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I made a guess at the fix but adding this seems to prevent any logging from occurring:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;&amp;lt;status = UART_GetStatusFlag(s_UartAdapterBase[instance]);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;gt;&amp;gt;status = UART_GetStatusFlag(s_UartAdapterBase[instance], kUART_AllInterruptsEnable);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Oct 2019 17:43:12 GMT</pubDate>
    <dc:creator>tom_orsi</dc:creator>
    <dc:date>2019-10-17T17:43:12Z</dc:date>
    <item>
      <title>Console Serial Debug Output Blocking</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Console-Serial-Debug-Output-Blocking/m-p/934827#M140077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The source code seems to support NON BLOCKING uart writes using the following CPP MACROS:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;DEBUG_CONSOLE_TRANSFER_NON_BLOCKING&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt; DEBUG_CONSOLE_TX_RELIABLE_ENABLE=1&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But using these macro produces the following compile time error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c: In function 'HAL_UartInterruptHandle':&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;/home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:165:14: error: too few arguments to function 'UART_GetStatusFlag'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; status = UART_GetStatusFlag(s_UartAdapterBase[instance]);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; ^~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;In file included from /home/torsi/projects/M4-FREERTOS/freertos/components/uart/iuart_adapter.c:10:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;/home/torsi/projects/M4-FREERTOS/freertos/devices/MIMX8MM6/drivers/fsl_uart.h:373:6: note: declared here&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; bool UART_GetStatusFlag(UART_Type *base, uint32_t flag);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt; ^~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I made a guess at the fix but adding this seems to prevent any logging from occurring:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;&amp;lt;status = UART_GetStatusFlag(s_UartAdapterBase[instance]);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;gt;&amp;gt;status = UART_GetStatusFlag(s_UartAdapterBase[instance], kUART_AllInterruptsEnable);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2019 17:43:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Console-Serial-Debug-Output-Blocking/m-p/934827#M140077</guid>
      <dc:creator>tom_orsi</dc:creator>
      <dc:date>2019-10-17T17:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Console Serial Debug Output Blocking</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Console-Serial-Debug-Output-Blocking/m-p/934828#M140078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delay, I was checking this section of the code and the odd behavior would be caused because&lt;/P&gt;&lt;P&gt;UART_GetStatusFlag(UART_Type *base, uint32_t flag);&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is expecting to receive the UART_Type and the flag to be checked,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;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&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;kUART_AllInterruptsEnable, is part of the _uart_interrupt_enable which contains the settings for all of the UART interrupt configurations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please let me know which toolchain/IDE are you using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Aldo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Oct 2019 18:55:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Console-Serial-Debug-Output-Blocking/m-p/934828#M140078</guid>
      <dc:creator>AldoG</dc:creator>
      <dc:date>2019-10-29T18:55:48Z</dc:date>
    </item>
  </channel>
</rss>

