<?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 problem with uart0 and printf in mke06 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330857#M68267</link>
    <description>&lt;P&gt;I have a PCB where I connect Bluetooth using &lt;STRONG&gt;UART0&lt;/STRONG&gt; with the &lt;STRONG&gt;MKE06Z128VQH4&lt;/STRONG&gt; MCU. First, I am doing communication tests using an &lt;STRONG&gt;FTDI&lt;/STRONG&gt; adapter and the &lt;STRONG&gt;Hercules terminal&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I am using the UART example from the SDK that comes configured for &lt;STRONG&gt;UART1&lt;/STRONG&gt;. I configured UART1 and used the example, and it worked well. However, I noticed that when it tries to use &lt;STRONG&gt;printf&lt;/STRONG&gt; for debugging, the information arrives &lt;STRONG&gt;truncated&lt;/STRONG&gt; in the Hercules terminal.&lt;/P&gt;&lt;P&gt;But that is not the main problem. The problem is that when I try the same example with &lt;STRONG&gt;UART0&lt;/STRONG&gt;, it does not work. When I send information from Hercules, I can see that inside the &lt;STRONG&gt;while loop&lt;/STRONG&gt; it enters the instruction to send data, which indicates that the information is received and the code attempts to send it. However, nothing appears in the Hercules terminal.&lt;/P&gt;&lt;P&gt;I disabled &lt;STRONG&gt;printf&lt;/STRONG&gt;, but I still have the same problem.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Mar 2026 19:05:35 GMT</pubDate>
    <dc:creator>Iotelctronic</dc:creator>
    <dc:date>2026-03-11T19:05:35Z</dc:date>
    <item>
      <title>problem with uart0 and printf in mke06</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330857#M68267</link>
      <description>&lt;P&gt;I have a PCB where I connect Bluetooth using &lt;STRONG&gt;UART0&lt;/STRONG&gt; with the &lt;STRONG&gt;MKE06Z128VQH4&lt;/STRONG&gt; MCU. First, I am doing communication tests using an &lt;STRONG&gt;FTDI&lt;/STRONG&gt; adapter and the &lt;STRONG&gt;Hercules terminal&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I am using the UART example from the SDK that comes configured for &lt;STRONG&gt;UART1&lt;/STRONG&gt;. I configured UART1 and used the example, and it worked well. However, I noticed that when it tries to use &lt;STRONG&gt;printf&lt;/STRONG&gt; for debugging, the information arrives &lt;STRONG&gt;truncated&lt;/STRONG&gt; in the Hercules terminal.&lt;/P&gt;&lt;P&gt;But that is not the main problem. The problem is that when I try the same example with &lt;STRONG&gt;UART0&lt;/STRONG&gt;, it does not work. When I send information from Hercules, I can see that inside the &lt;STRONG&gt;while loop&lt;/STRONG&gt; it enters the instruction to send data, which indicates that the information is received and the code attempts to send it. However, nothing appears in the Hercules terminal.&lt;/P&gt;&lt;P&gt;I disabled &lt;STRONG&gt;printf&lt;/STRONG&gt;, but I still have the same problem.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2026 19:05:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330857#M68267</guid>
      <dc:creator>Iotelctronic</dc:creator>
      <dc:date>2026-03-11T19:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: problem with uart0 and printf in mke06</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330875#M68268</link>
      <description>&lt;P&gt;my code is this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#include "board.h"
#include "fsl_uart.h"
#include "pin_mux.h"
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;



#define DEMO_UART            UART0
#define DEMO_UART_CLK_FREQ   CLOCK_GetFreq(kCLOCK_BusClk)
#define DEMO_UART_IRQn       UART0_IRQn
#define DEMO_UART_IRQHandler UART0_IRQHandler

#define RING_BUFFER_SIZE 16
uint8_t ringBuffer[RING_BUFFER_SIZE];
volatile uint16_t txIndex = 0;
volatile uint16_t rxIndex = 0;

void DEMO_UART_IRQHandler(void)
{
    uint8_t data;
    if (kUART_RxDataRegFullFlag &amp;amp; UART_GetStatusFlags(DEMO_UART))
    {
        data = UART_ReadByte(DEMO_UART);
        if (((rxIndex + 1) % RING_BUFFER_SIZE) != txIndex)
        {
            ringBuffer[rxIndex] = data;
            rxIndex = (rxIndex + 1) % RING_BUFFER_SIZE;
        }
    }
    SDK_ISR_EXIT_BARRIER;
}

int main(void)
{
    BOARD_InitBootPins();
    BOARD_InitBootClocks();


    uart_config_t config;
    UART_GetDefaultConfig(&amp;amp;config);
    config.baudRate_Bps = 115200;
    config.enableTx = true;
    config.enableRx = true;

    UART_Init(DEMO_UART, &amp;amp;config, DEMO_UART_CLK_FREQ);

    // Mensaje de bienvenida por UART0
    uint8_t welcome[] = "Sistema iniciado - Comunicacion con Hercules\r\n";
    UART_WriteBlocking(DEMO_UART, welcome, sizeof(welcome)-1);

    UART_EnableInterrupts(DEMO_UART, kUART_RxDataRegFullInterruptEnable);
    EnableIRQ(DEMO_UART_IRQn);

    while (1)
    {
        // Eco de los datos recibidos
        if (rxIndex != txIndex)
        {
            UART_WriteByte(DEMO_UART, ringBuffer[txIndex]);
            txIndex = (txIndex + 1) % RING_BUFFER_SIZE;
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Mar 2026 19:58:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330875#M68268</guid>
      <dc:creator>Iotelctronic</dc:creator>
      <dc:date>2026-03-11T19:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: problem with uart0 and printf in mke06</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330992#M68270</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/257315"&gt;@Iotelctronic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;Please verify that the UART0‑TX pin on your board is properly configured in your software code, and ensure that the correct baud rate is selected in Hercules.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;BR&lt;/DIV&gt;
&lt;DIV&gt;Alice&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Mar 2026 02:40:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2330992#M68270</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2026-03-12T02:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem with uart0 and printf in mke06</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2331406#M68271</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello! Thank you for your response. The pin configurations are in pin_mux.c as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void BOARD_InitPins(void)
{
    /* pin 48,47 is configured as UART0_RX, UART0_TX */
    PORT_SetPinSelect(kPORT_UART0, kPORT_UART0_RXPTA2_TXPTA3);

    SIM-&amp;gt;SOPT0 = ((SIM-&amp;gt;SOPT0 &amp;amp;
                   /* Mask bits to zero which are setting */
                   (~(SIM_SOPT0_RXDFE_MASK)))

                  /* UART0 RxD Filter Select: RXD0 input signal is connected to UART0 module directly. */
                  | SIM_SOPT0_RXDFE(SOPT0_RXDFE_0b00));
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the configtool:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="uart.JPG" style="width: 820px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/379088i3FA5CC0F078F303B/image-size/large?v=v2&amp;amp;px=999" role="button" title="uart.JPG" alt="uart.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hercules.JPG" style="width: 605px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/379089iDB9554EA1F9B2BD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="hercules.JPG" alt="hercules.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in the hercules have the correct baud:115200. i can view the data in the buffer rx, but the eco tx for hercules not. this case is with uart0, with uart1 is working well.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2026 11:21:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/problem-with-uart0-and-printf-in-mke06/m-p/2331406#M68271</guid>
      <dc:creator>Iotelctronic</dc:creator>
      <dc:date>2026-03-12T11:21:55Z</dc:date>
    </item>
  </channel>
</rss>

