<?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>Kinetis Microcontrollers中的主题 I need help with UART5 on TWR-K60N512</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327650#M15136</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having problems working with UART5 to communicate with the pc through USB. I'm trying to send a message to the pc, therefore i'm only using Tx. The problem is that i'm trying to write in some registers but the values don't change. Also, i don't know how to set the baud rate to 9600 bps. &lt;BR /&gt;I would appreciate some help. The program is what follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include "derivative.h" /* include peripheral declarations */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; int i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint8_t message[] = "Hello World";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //enable clock to port E&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC5 |= 1&amp;lt;&amp;lt;13;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //enable clock to UART5 module&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC1 |= 1&amp;lt;&amp;lt;11;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //set pin 8 from port E as UART5_Tx&lt;/P&gt;&lt;P&gt;&amp;nbsp; PORTE_PCR8 |= 0x00000300; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Disable Receiver and Transmitter to change UART settings&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C2 &amp;amp;= ~0x0c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Configure the UART for 8-bit mode, no parity&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C1 = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Set the baud rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;gt; &lt;SPAN style="text-decoration: underline;"&gt;I don't know how to set the baud rate to 9600 bps&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_BDL = 4; //UART_BDL_SBR(9600);&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_BDH = 4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Enable Transmitter&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C2 |= 1&amp;lt;&amp;lt;3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Writing in the transmitter data register&lt;/P&gt;&lt;P&gt;&amp;nbsp; for (i = 0; message[i] != '\0'; i++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_D = message[i];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;gt; &lt;SPAN style="text-decoration: underline;"&gt;the register doesn't change and i don't know why&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 22 Feb 2015 21:33:32 GMT</pubDate>
    <dc:creator>ricardomoreira</dc:creator>
    <dc:date>2015-02-22T21:33:32Z</dc:date>
    <item>
      <title>I need help with UART5 on TWR-K60N512</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327650#M15136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having problems working with UART5 to communicate with the pc through USB. I'm trying to send a message to the pc, therefore i'm only using Tx. The problem is that i'm trying to write in some registers but the values don't change. Also, i don't know how to set the baud rate to 9600 bps. &lt;BR /&gt;I would appreciate some help. The program is what follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include "derivative.h" /* include peripheral declarations */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; int i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; uint8_t message[] = "Hello World";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //enable clock to port E&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC5 |= 1&amp;lt;&amp;lt;13;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //enable clock to UART5 module&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC1 |= 1&amp;lt;&amp;lt;11;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //set pin 8 from port E as UART5_Tx&lt;/P&gt;&lt;P&gt;&amp;nbsp; PORTE_PCR8 |= 0x00000300; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Disable Receiver and Transmitter to change UART settings&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C2 &amp;amp;= ~0x0c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Configure the UART for 8-bit mode, no parity&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C1 = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Set the baud rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;gt; &lt;SPAN style="text-decoration: underline;"&gt;I don't know how to set the baud rate to 9600 bps&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_BDL = 4; //UART_BDL_SBR(9600);&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_BDH = 4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Enable Transmitter&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_C2 |= 1&amp;lt;&amp;lt;3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Writing in the transmitter data register&lt;/P&gt;&lt;P&gt;&amp;nbsp; for (i = 0; message[i] != '\0'; i++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; UART5_D = message[i];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &amp;gt; &lt;SPAN style="text-decoration: underline;"&gt;the register doesn't change and i don't know why&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Feb 2015 21:33:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327650#M15136</guid>
      <dc:creator>ricardomoreira</dc:creator>
      <dc:date>2015-02-22T21:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with UART5 on TWR-K60N512</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327651#M15137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will find useful the document &lt;A href="http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KQRUG.pdf"&gt;KQRUG &lt;/A&gt;in the section UART initialization example you can find useful information about the UART initialization process and registers. Please refer to the document for more details.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this information can help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Adrian Sanchez Cano&lt;BR /&gt;Technical Support Engineer&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2015 23:17:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327651#M15137</guid>
      <dc:creator>adriancano</dc:creator>
      <dc:date>2015-02-23T23:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with UART5 on TWR-K60N512</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327652#M15138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ricardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The Baud rate of UART5 depends on your Bus Clock. If you have 50MHz then 9600 Baud is obtained by&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ucFraction = (unsigned char)((float)((((float)BUS_CLOCK/(float)16/(float)9600) - (int)(BUS_CLOCK/16/9600)) * 32)); // calculate fraction&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;usDivider = (BUS_CLOCK/16/9600);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UART5_C4 = ucFraction; // 0x10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UART5_BDH = (unsigned char)(usDivider &amp;gt;&amp;gt; 8); 0x01; // (0x145 &amp;gt;&amp;gt; 8)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UART5_BDL = (unsigned char)(usDivider); // (0x145 &amp;amp; 0xff)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. UART5_D is a &lt;SPAN style="text-decoration: underline;"&gt;write&lt;/SPAN&gt; register for sending data and &lt;SPAN style="text-decoration: underline;"&gt;read&lt;/SPAN&gt; for receiving data. Therefore you can't read the value back that you write (send) unless the TXD line is connected to the RXD line and your receiver is also enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. You also need to modify your transmission loop since this will overrun the output - it needs to check that there is space in its output buffer/FIFO and wait if there isn't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;K60: &lt;A href="http://www.utasker.com/kinetis/TWR-K60N512.html" title="http://www.utasker.com/kinetis/TWR-K60N512.html"&gt;µTasker Kinetis TWR-K60N512 support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/TWR-K60D100M.html" title="http://www.utasker.com/kinetis/TWR-K60D100M.html"&gt;µTasker Kinetis TWR-K60D100M support&lt;/A&gt; / &lt;A href="http://www.utasker.com/kinetis/TWR-K60F120M.html" title="http://www.utasker.com/kinetis/TWR-K60F120M.html"&gt;µTasker Kinetis TWR-K60F120M support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;UARTs/PUARTs: &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerUART.PDF" title="http://www.utasker.com/docs/uTasker/uTaskerUART.PDF"&gt;http://www.utasker.com/docs/uTasker/uTaskerUART.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Feb 2015 23:56:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I-need-help-with-UART5-on-TWR-K60N512/m-p/327652#M15138</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-02-23T23:56:44Z</dc:date>
    </item>
  </channel>
</rss>

