<?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 UART receiving problem with LPC1227 in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532667#M3210</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Tue Jul 09 05:25:15 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i am writing a program which receives 0x03 and 0x04 strings continusly via UART0 and sends to a device through UART1.The device responds with a 3 bit data for each command(0x03 and 0x04).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-1 sends 0x03 =&amp;gt;uart0----- LPC1227-----UART1=&amp;gt;0x03 to the device2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-2 sends 0x01 0x0c 0xff =&amp;gt;uart1----- LPC1227-----UART0=&amp;gt;0x01 0x0c 0xffto the device1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-1 sends 0x04 =&amp;gt;uart0----- LPC1227-----UART1=&amp;gt;0x04 to the device2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-2 sends 0x01 0x0c 0xff =&amp;gt;uart1----- LPC1227-----UART0=&amp;gt;0x01 0x0c 0xffto the device1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first bit of the receving bit is a command and it should be always 0x01.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;my problem is in receiving the 3 bit data , some times the device 2 will not send 3 bits of data insted it will send 1 or 2 bits and my getchar waits for receiving it and the program enter into a endless loop.so any one can help me in writing a timer which waits for receiving the data for 5 ms and after 5ms , if there is no data received restart or clear the uart buffer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:39:34 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:39:34Z</dc:date>
    <item>
      <title>UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532667#M3210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Tue Jul 09 05:25:15 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i am writing a program which receives 0x03 and 0x04 strings continusly via UART0 and sends to a device through UART1.The device responds with a 3 bit data for each command(0x03 and 0x04).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-1 sends 0x03 =&amp;gt;uart0----- LPC1227-----UART1=&amp;gt;0x03 to the device2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-2 sends 0x01 0x0c 0xff =&amp;gt;uart1----- LPC1227-----UART0=&amp;gt;0x01 0x0c 0xffto the device1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-1 sends 0x04 =&amp;gt;uart0----- LPC1227-----UART1=&amp;gt;0x04 to the device2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DEVICE-2 sends 0x01 0x0c 0xff =&amp;gt;uart1----- LPC1227-----UART0=&amp;gt;0x01 0x0c 0xffto the device1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first bit of the receving bit is a command and it should be always 0x01.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;my problem is in receiving the 3 bit data , some times the device 2 will not send 3 bits of data insted it will send 1 or 2 bits and my getchar waits for receiving it and the program enter into a endless loop.so any one can help me in writing a timer which waits for receiving the data for 5 ms and after 5ms , if there is no data received restart or clear the uart buffer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532667#M3210</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532668#M3211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Tue Jul 09 06:09:07 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;3 bits of data&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;I assume you means [B]bytes[/B].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The quick and dirty way is to wrap your getchar() in a loop with a counter and maybe a short delay. If you get a character you return from inside the loop, if the loop terminates you timed out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also read the systick value ( SysTick-&amp;gt;VAL; ) and return after 5mS has passed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532668#M3211</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532669#M3212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Tue Jul 09 07:29:13 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any have an idea about receiving strings without waiting more than 3 ms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int UART1_getchar (void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (!(LPC_UART1-&amp;gt;LSR &amp;amp; 0x01))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return (LPC_UART1-&amp;gt;RBR);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i tried to remove the loop, but it making errors in receiving the second and third data.so i need a proper counder or timer to me executed after sending the data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Arun&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532669#M3212</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532670#M3213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Tue Jul 09 07:35:27 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: graynomad&lt;/STRONG&gt;&lt;BR /&gt;I assume you means [B]bytes[/B].&lt;BR /&gt;&lt;BR /&gt;The quick and dirty way is to wrap your getchar() in a loop with a counter and maybe a short delay. If you get a character you return from inside the loop, if the loop terminates you timed out.&lt;BR /&gt;&lt;BR /&gt;You could also read the systick value ( SysTick-&amp;gt;VAL; ) and return after 5mS has passed.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are exactly right.but i had found a different way of implimentation .plan to make a delay in uart1 receive.the uart 1 rx will jump from the infinite loop without receiving any charactor after 5 ms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int UART1_getchar (void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (!(LPC_UART1-&amp;gt;LSR &amp;amp; 0x01))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return (LPC_UART1-&amp;gt;RBR);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;any idea to execute a timer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532670#M3213</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532671#M3214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by graynomad on Tue Jul 09 17:23:17 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't got any experience with the HW timers so all I can suggest at this point is a dodgy software "timer"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;int UART1_getchar (void) {

&amp;nbsp;&amp;nbsp;&amp;nbsp; for (long i = 0; i &amp;lt; some_really_big_number; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!(LPC_UART1-&amp;gt;LSR &amp;amp; 0x01)){
&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;nbsp; return (LPC_UART1-&amp;gt;RBR);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return (ERROR_TIMEOUT);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532671#M3214</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532672#M3215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Tue Jul 09 23:50:52 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;There are examples in the LPC12xx examples supplied with LPCXpresso that show the use of both Systick and Timer peripherals. Suggest you start off by looking at those.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532672#M3215</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532673#M3216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Wed Jul 10 02:36:59 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532673#M3216</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: UART receiving problem with LPC1227</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532674#M3217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arunkollam on Wed Jul 10 02:44:18 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:39:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/UART-receiving-problem-with-LPC1227/m-p/532674#M3217</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:39:39Z</dc:date>
    </item>
  </channel>
</rss>

