<?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 Re:     Read string from uart in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687610#M42328</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt; &amp;nbsp; I have tried tat code.when i give data,uart isr is not at all getting activated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 May 2017 08:24:24 GMT</pubDate>
    <dc:creator>kanimozhiraju</dc:creator>
    <dc:date>2017-05-22T08:24:24Z</dc:date>
    <item>
      <title>Read string from uart</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687607#M42325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Hi @ kerry,&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with uart receive interrupt i try to read string and compare the string with constant string and process further.But i sent data from app and i received .I am not getting the data when i sent once i have to send 3 times to receive the printf statement .i will attach my code now&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;/*&amp;nbsp;* File:&amp;nbsp; receiving data from app&amp;nbsp;* Purpose:&amp;nbsp; Main&amp;nbsp;*&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;#include "common.h"#include "isr.h"&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;char data[10]="MEASR_TEMP;char testdata[10];char rec[10];uint8 s_flag=0;uint8 i=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;void UART1_isr(void){&amp;nbsp; if (UART1_S1&amp;amp;UART_S1_RDRF_MASK)&amp;nbsp; {&amp;nbsp; &amp;nbsp; while(i&amp;lt;10)&amp;nbsp; &amp;nbsp; {&amp;nbsp; &amp;nbsp; testdata[i] = UART1_D;&amp;nbsp; &amp;nbsp; i++;&amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp;// printf("%c",testdata);&amp;nbsp; }&amp;nbsp;&amp;nbsp; strncpy(rec,testdata,10);&amp;nbsp; if((strncmp(rec,data,10)==0))&amp;nbsp; {&amp;nbsp; &amp;nbsp; uint8 s_flag=1;&amp;nbsp; }}&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;void main (void){&amp;nbsp; &amp;nbsp;printf("kiosk implementation\n");&amp;nbsp; &amp;nbsp;UART1_C2 |= UART_C2_RIE_MASK ;&amp;nbsp; // UART1_D=testdata;&amp;nbsp; &amp;nbsp;enable_irq(47);&amp;nbsp; &amp;nbsp;while(1)&amp;nbsp; &amp;nbsp;{&amp;nbsp; &amp;nbsp; &amp;nbsp;if(s_flag==1)&amp;nbsp; &amp;nbsp; &amp;nbsp;{&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf("spo2");&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf("level:\n");&amp;nbsp; &amp;nbsp; &amp;nbsp;}&amp;nbsp; &amp;nbsp;}&amp;nbsp;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 05:04:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687607#M42325</guid>
      <dc:creator>kanimozhiraju</dc:creator>
      <dc:date>2017-05-22T05:04:35Z</dc:date>
    </item>
    <item>
      <title>Re:     Read string from uart</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687608#M42326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello kanimozhi Raju,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thank you for your cooperation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Your code is wrong, you can't write the UART1_isr like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Actually, after you enable the receive interrupt, then when the mcu received one byte, it will enter in the UART1_isr one times, the next byte data&amp;nbsp; will caused the next ISR, you can't use the while() in the ISR, you must exit the interrupt handler to wait the next the byte coming.&lt;/P&gt;&lt;P&gt;I have modified your code like this:&lt;/P&gt;&lt;P&gt;#include "common.h"#include "isr.h"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char data[10]="MEASR_TEMP;&lt;BR /&gt;char testdata[10];&lt;BR /&gt;char rec[10];&lt;BR /&gt;uint8 s_flag=0;&lt;BR /&gt;volatile uint8 i=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void UART1_isr(void)&lt;BR /&gt;{ &amp;nbsp;&lt;BR /&gt;&amp;nbsp; if (UART1_S1&amp;amp;UART_S1_RDRF_MASK) &amp;nbsp;&lt;BR /&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testdata[i++] = UART1_D;&lt;BR /&gt;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; void main (void)&lt;BR /&gt;&amp;nbsp; {&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("kiosk implementation\n");&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART1_C2 |= UART_C2_RIE_MASK ; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // UART1_D=testdata;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable_irq(47);&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i&amp;gt;=10)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strncpy(rec,testdata,10); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("spo2");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("level:\n");&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s_flag=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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, 22 May 2017 06:10:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687608#M42326</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-05-22T06:10:44Z</dc:date>
    </item>
    <item>
      <title>Re:     Read string from uart</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687609#M42327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/kerryzhou"&gt;kerryzhou&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have tried tat code.when i give data,uart isr is not at all getting activated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 07:50:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687609#M42327</guid>
      <dc:creator>kanimozhiraju</dc:creator>
      <dc:date>2017-05-22T07:50:49Z</dc:date>
    </item>
    <item>
      <title>Re:     Read string from uart</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687610#M42328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt; &amp;nbsp; I have tried tat code.when i give data,uart isr is not at all getting activated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 08:24:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687610#M42328</guid>
      <dc:creator>kanimozhiraju</dc:creator>
      <dc:date>2017-05-22T08:24:24Z</dc:date>
    </item>
    <item>
      <title>Re:     Read string from uart</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687611#M42329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kanimozhi Raju,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I just simply modify your code, give you the process method.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Did your own code can enter receive uart isr before?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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, 22 May 2017 09:00:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Read-string-from-uart/m-p/687611#M42329</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-05-22T09:00:09Z</dc:date>
    </item>
  </channel>
</rss>

