<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UART input interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18881/uart-input-interrupt</link><description>Hello, 
 I&amp;#39;m new to Nordic nRF52 and trying to send commands via termial to nRF52. After receiving commands, nRF52 will use these commands to do i2c communication with other peripherals. My project is based on nRF5_SDK_11.0.0\examples\peripheral\uart</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Jan 2017 12:10:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18881/uart-input-interrupt" /><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72957?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2017 12:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9608f78-3403-483c-9547-efbaba190ba9</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Click the grey check mark below the arrows on the left side of the answer ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72956?ContentTypeID=1</link><pubDate>Sat, 14 Jan 2017 01:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ed3ce8a-9ce2-4389-80c2-32ab76d898f6</guid><dc:creator>Switchfeet</dc:creator><description>&lt;p&gt;How to mark the answer as correct? I can&amp;#39;t find this kind of option :|&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72955?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 12:41:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4de4746b-8b26-4bef-b118-53c2b9a43a72</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;No problem! Could you mark the answer as correct so others can see that it was useful?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72954?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2017 03:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0b1d342-a1d5-4f0c-826e-bed5736f5a69</guid><dc:creator>Switchfeet</dc:creator><description>&lt;p&gt;@Ole Bauck&lt;/p&gt;
&lt;p&gt;Thank you for your reply! It&amp;#39;s very useful!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72953?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2017 15:06:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5472d7f5-a128-4ea2-a27f-2f32774cf914</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You need to set index to 0 after doing the string compares or else the index will increase indefinitely and eventually corrupt your RAM:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (data_array[index - 1] == &amp;#39;\r&amp;#39;) {
    data_array[index - 1] = &amp;#39;\0&amp;#39;;
    if (strcmp((const char *)data_array, &amp;quot;:0200FA&amp;quot;) == 0) {
		printf(&amp;quot;\r\nCMD 1 Received\r\n&amp;quot;);
    }
	if (strcmp((const char *)data_array, &amp;quot;:100456g011&amp;quot;) == 0) {
        printf(&amp;quot;\r\nCMD 2 Received\r\n&amp;quot;);
    }
    index = 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should check out &lt;a href="http://stackoverflow.com/questions/5033627/static-variable-inside-of-a-function-in-c"&gt;this&lt;/a&gt; for explanation of what the static keyword means in this situation (&lt;code&gt;static uint8_t index = 0&lt;/code&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART input interrupt</title><link>https://devzone.nordicsemi.com/thread/72952?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2017 09:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a456bb6-f287-425b-973b-babcf7c992dd</guid><dc:creator>Switchfeet</dc:creator><description>&lt;p&gt;Temporarily solve first problem by clearing data_array after printf.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>