<?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>i.MX ProcessorsのトピックUART imx6 trash problem</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/UART-imx6-trash-problem/m-p/645776#M98559</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to port FreeRTOS to execute in the imx6 smart devices board and I'm developing the needed drivers to do it and I am facing an issue trying to use the serial port, I have seen many examples using the serial port but everything I do goes the same way. If I use a function to print just one character. I am able to print the character, like one by one(Calling the same function separately), but if I use a function to print a string for example, that is nothing more than print some characters one after the other i only get trash in my port. I will put my code here, if you could help me would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function I use for the serial port configuration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int mxc_serial_init(void)&lt;BR /&gt;{&lt;BR /&gt; int tmp;&lt;BR /&gt; __REG((0x020e0000) + 0x280) = 0x00000003; // ALT3 CSI0_DAT10 TxD&lt;BR /&gt; __REG((0x020e0000) + 0x284) = 0x00000003; // ALT3 CSI0_DAT11 RxD&lt;BR /&gt; __REG((0x020e0000) + 0x920) = 0x00000001; //UART1_UART_RX_DATA_SELECT_INPUT&lt;BR /&gt; tmp=__REG((0x020c4000) + 0x24) &amp;amp; 0x0000003F ; //CSCDR1 uart_podf div by 1&lt;BR /&gt; __REG((0x020c4000) + 0x24) = tmp; // UART refclk = 80MHz&lt;BR /&gt; &lt;BR /&gt; // Enable UART1&lt;BR /&gt; // enable uart1, ignore RTS, wordsize 8bits, 1 stop bit, no parity&lt;BR /&gt; __REG(UART1_BASE + UCR2) = 0x01; // reset UART state machines &lt;BR /&gt; __REG(UART1_BASE + UCR2) = 0x2006; // UCR2 = CTSC,TXEN,RXEN=1,reset&lt;BR /&gt; __REG(UART1_BASE + UCR1) = 0x0001; // UARTEN = 1,enable the clock&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_IRTS; // configure IRTS bit&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_WS ;&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_STPB;&lt;BR /&gt; __REG(UART1_BASE + UCR3) |= 0x00000004; // set RXD_MUX_SEL bit&lt;BR /&gt; __REG(UART1_BASE + UCR1) |= 0x0201; // recieve ready interput enable&lt;/P&gt;&lt;P&gt;// disable parity&lt;BR /&gt; __REG(UART1_BASE + UCR2) &amp;amp;= ~(0x00000100);&lt;/P&gt;&lt;P&gt;//SetRFDIV_to_div_by_1_UART1(); &lt;BR /&gt; tmp = __REG(UART1_BASE + UCR1); // save UFCR to default value&lt;BR /&gt; __REG(UART1_BASE + UFCR) = 5&amp;lt;&amp;lt;7; // set RFDIV to div-by-1 or b101 &lt;BR /&gt; __REG(UART1_BASE + UFCR) |= tmp; // set other UFCR bits back to default&lt;BR /&gt; __REG(UART1_BASE + UBIR) = 0x4;&lt;BR /&gt; __REG(UART1_BASE + UBMR) = 0xD8;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;These next two functions I use to print a character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int mxc_can_putc(void)&lt;BR /&gt;{&lt;BR /&gt; unsigned int status = __REG(uart_address_global + UTS);&lt;BR /&gt; &lt;BR /&gt; if (status &amp;amp; UTS_TXFULL)&lt;BR /&gt; {&lt;BR /&gt; return FALSE;&lt;BR /&gt; } &lt;BR /&gt; else &lt;BR /&gt; {&lt;BR /&gt; return TRUE;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void mxc_serial_putc(signed char c)&lt;BR /&gt;{ &lt;BR /&gt; /* wait for transmitter to be ready */&lt;BR /&gt; while (!mxc_can_putc());&lt;BR /&gt; //while(__REG(uart_address_global + UTS) &amp;amp; UTS_TXFULL)&lt;BR /&gt; __REG(UART_PHYS + UTXD) = c;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this one I use to print a string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void mxc_serial_puts(char *s)&lt;BR /&gt;{&lt;BR /&gt; //int aaa = 0;&lt;BR /&gt; while (*s)&lt;BR /&gt; {&lt;BR /&gt; //while (!mxc_can_putc());&lt;BR /&gt; mxc_serial_putc(*s++);&lt;BR /&gt; //for(aaa = 0; aaa &amp;lt; 500000000; aaa++);&lt;BR /&gt; &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, if I call myself the putc function I can print the char I want, but if I use the puts I only get trash.&lt;/P&gt;&lt;P&gt;Like in the next example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void _init(void) &lt;BR /&gt;{ &lt;BR /&gt; mxc_serial_init();&lt;BR /&gt; mxc_serial_putc('i');&lt;BR /&gt; mxc_serial_putc('n');&lt;BR /&gt; mxc_serial_putc('i');&lt;BR /&gt; mxc_serial_putc('t');&lt;BR /&gt; mxc_serial_putc('\n');&lt;BR /&gt; mxc_serial_puts("aaaaa1\n");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the output i have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;init&lt;BR /&gt;���e����m��s��{m�O�1\-+��^�� T .�Uq���}'qע�����d&amp;#127;���u�/����I��=&amp;gt;�?��M�; �����w���=Pj���w�.�`�mw]�uF&amp;gt;�wo���ܹ�{�X�7}I����&amp;#127;3���/?�&amp;#127;���cf �.�N���� �)����\���ݽ��￱�לm���λz�z����/~Cɽ/T����Z���� ��&amp;lt;�{���j� O��H��� |� E����_���^�&amp;nbsp; ֕� �v����s�ͫ&amp;lt;���ʳ�����=�l��ܗ�������7G?�?�&amp;#127;� |���U}��埧��}ս�������3�� ��Ӷg�?��t|�V��������c�����Go�o��M]�{�&amp;gt;��}Ğum�~{�Rjo/��&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know what can possibly causing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;João Silva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 03 Dec 2016 18:35:44 GMT</pubDate>
    <dc:creator>joãosilva</dc:creator>
    <dc:date>2016-12-03T18:35:44Z</dc:date>
    <item>
      <title>UART imx6 trash problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/UART-imx6-trash-problem/m-p/645776#M98559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to port FreeRTOS to execute in the imx6 smart devices board and I'm developing the needed drivers to do it and I am facing an issue trying to use the serial port, I have seen many examples using the serial port but everything I do goes the same way. If I use a function to print just one character. I am able to print the character, like one by one(Calling the same function separately), but if I use a function to print a string for example, that is nothing more than print some characters one after the other i only get trash in my port. I will put my code here, if you could help me would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function I use for the serial port configuration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int mxc_serial_init(void)&lt;BR /&gt;{&lt;BR /&gt; int tmp;&lt;BR /&gt; __REG((0x020e0000) + 0x280) = 0x00000003; // ALT3 CSI0_DAT10 TxD&lt;BR /&gt; __REG((0x020e0000) + 0x284) = 0x00000003; // ALT3 CSI0_DAT11 RxD&lt;BR /&gt; __REG((0x020e0000) + 0x920) = 0x00000001; //UART1_UART_RX_DATA_SELECT_INPUT&lt;BR /&gt; tmp=__REG((0x020c4000) + 0x24) &amp;amp; 0x0000003F ; //CSCDR1 uart_podf div by 1&lt;BR /&gt; __REG((0x020c4000) + 0x24) = tmp; // UART refclk = 80MHz&lt;BR /&gt; &lt;BR /&gt; // Enable UART1&lt;BR /&gt; // enable uart1, ignore RTS, wordsize 8bits, 1 stop bit, no parity&lt;BR /&gt; __REG(UART1_BASE + UCR2) = 0x01; // reset UART state machines &lt;BR /&gt; __REG(UART1_BASE + UCR2) = 0x2006; // UCR2 = CTSC,TXEN,RXEN=1,reset&lt;BR /&gt; __REG(UART1_BASE + UCR1) = 0x0001; // UARTEN = 1,enable the clock&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_IRTS; // configure IRTS bit&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_WS ;&lt;BR /&gt; __REG(UART1_BASE + UCR2) |= UCR2_STPB;&lt;BR /&gt; __REG(UART1_BASE + UCR3) |= 0x00000004; // set RXD_MUX_SEL bit&lt;BR /&gt; __REG(UART1_BASE + UCR1) |= 0x0201; // recieve ready interput enable&lt;/P&gt;&lt;P&gt;// disable parity&lt;BR /&gt; __REG(UART1_BASE + UCR2) &amp;amp;= ~(0x00000100);&lt;/P&gt;&lt;P&gt;//SetRFDIV_to_div_by_1_UART1(); &lt;BR /&gt; tmp = __REG(UART1_BASE + UCR1); // save UFCR to default value&lt;BR /&gt; __REG(UART1_BASE + UFCR) = 5&amp;lt;&amp;lt;7; // set RFDIV to div-by-1 or b101 &lt;BR /&gt; __REG(UART1_BASE + UFCR) |= tmp; // set other UFCR bits back to default&lt;BR /&gt; __REG(UART1_BASE + UBIR) = 0x4;&lt;BR /&gt; __REG(UART1_BASE + UBMR) = 0xD8;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;These next two functions I use to print a character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int mxc_can_putc(void)&lt;BR /&gt;{&lt;BR /&gt; unsigned int status = __REG(uart_address_global + UTS);&lt;BR /&gt; &lt;BR /&gt; if (status &amp;amp; UTS_TXFULL)&lt;BR /&gt; {&lt;BR /&gt; return FALSE;&lt;BR /&gt; } &lt;BR /&gt; else &lt;BR /&gt; {&lt;BR /&gt; return TRUE;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void mxc_serial_putc(signed char c)&lt;BR /&gt;{ &lt;BR /&gt; /* wait for transmitter to be ready */&lt;BR /&gt; while (!mxc_can_putc());&lt;BR /&gt; //while(__REG(uart_address_global + UTS) &amp;amp; UTS_TXFULL)&lt;BR /&gt; __REG(UART_PHYS + UTXD) = c;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this one I use to print a string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void mxc_serial_puts(char *s)&lt;BR /&gt;{&lt;BR /&gt; //int aaa = 0;&lt;BR /&gt; while (*s)&lt;BR /&gt; {&lt;BR /&gt; //while (!mxc_can_putc());&lt;BR /&gt; mxc_serial_putc(*s++);&lt;BR /&gt; //for(aaa = 0; aaa &amp;lt; 500000000; aaa++);&lt;BR /&gt; &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, if I call myself the putc function I can print the char I want, but if I use the puts I only get trash.&lt;/P&gt;&lt;P&gt;Like in the next example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void _init(void) &lt;BR /&gt;{ &lt;BR /&gt; mxc_serial_init();&lt;BR /&gt; mxc_serial_putc('i');&lt;BR /&gt; mxc_serial_putc('n');&lt;BR /&gt; mxc_serial_putc('i');&lt;BR /&gt; mxc_serial_putc('t');&lt;BR /&gt; mxc_serial_putc('\n');&lt;BR /&gt; mxc_serial_puts("aaaaa1\n");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the output i have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;init&lt;BR /&gt;���e����m��s��{m�O�1\-+��^�� T .�Uq���}'qע�����d&amp;#127;���u�/����I��=&amp;gt;�?��M�; �����w���=Pj���w�.�`�mw]�uF&amp;gt;�wo���ܹ�{�X�7}I����&amp;#127;3���/?�&amp;#127;���cf �.�N���� �)����\���ݽ��￱�לm���λz�z����/~Cɽ/T����Z���� ��&amp;lt;�{���j� O��H��� |� E����_���^�&amp;nbsp; ֕� �v����s�ͫ&amp;lt;���ʳ�����=�l��ܗ�������7G?�?�&amp;#127;� |���U}��埧��}ս�������3�� ��Ӷg�?��t|�V��������c�����Go�o��M]�{�&amp;gt;��}Ğum�~{�Rjo/��&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know what can possibly causing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;João Silva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Dec 2016 18:35:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/UART-imx6-trash-problem/m-p/645776#M98559</guid>
      <dc:creator>joãosilva</dc:creator>
      <dc:date>2016-12-03T18:35:44Z</dc:date>
    </item>
  </channel>
</rss>

