<?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>nRF51822 Processing of received UART data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49666/nrf51822-processing-of-received-uart-data</link><description>Hi everyone. 
 I have a problem with processing with recived UART data. I&amp;#39;m using software UART from example &amp;gt; peripheral &amp;gt; uart. 
 I use nRF to comunicate with GSM module. When I send AT command need to check recived data. Example shows how react to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jul 2019 20:51:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49666/nrf51822-processing-of-received-uart-data" /><item><title>RE: nRF51822 Processing of received UART data</title><link>https://devzone.nordicsemi.com/thread/198812?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2019 20:51:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:751b5ef8-13a5-481b-b62c-88ff94eb0dcd</guid><dc:creator>Rafaello</dc:creator><description>&lt;p&gt;I got the solution!&lt;br /&gt;My GSM module had enabled echo function. When I send AT command it repeat after me then send answer.&lt;br /&gt;When I disable echo function everything work fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Processing of received UART data</title><link>https://devzone.nordicsemi.com/thread/198337?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2019 08:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92be0bc9-6f8a-4267-a896-c85662aaaaa7</guid><dc:creator>Rafaello</dc:creator><description>&lt;p&gt;Hi, Overbekk.&lt;/p&gt;
&lt;p&gt;Yes, you understand it correct. I can find the string but was thinking if is any better way than mine.&lt;/p&gt;
&lt;p&gt;And the main problem is with with data.&lt;/p&gt;
&lt;p&gt;Your way to clean buffer is much better so thanks for it.&lt;/p&gt;
&lt;p&gt;Nevertheless problem is still here.&lt;/p&gt;
&lt;p&gt;I checked it with &amp;quot;simple LED debuger&amp;quot;&lt;/p&gt;
&lt;p&gt;I was sending &amp;quot;AT&amp;quot; command in the loop. GSM module should respond with OK. I set:&lt;/p&gt;
&lt;p&gt;If get OK toggle 1st LED.&lt;/p&gt;
&lt;p&gt;else toggle 2nd LED.&lt;/p&gt;
&lt;p&gt;And i found something like that:&lt;/p&gt;
&lt;p&gt;After first AT command nRF toggled second LED (something different than OK), at second AT command toggled 1 LED (OK) . And it was repeated. First 2nd LED then 1st LED and again 2nd LED again 1st LED and again and again.&lt;/p&gt;
&lt;p&gt;It looks like something is wrong with command sending or with reciving function.&lt;/p&gt;
&lt;p&gt;To send command I used:&lt;/p&gt;
&lt;p&gt;app_uart_put(&amp;#39;A&amp;#39;);&lt;/p&gt;
&lt;p&gt;app_uart_put(&amp;#39;T&amp;#39;);&lt;/p&gt;
&lt;p&gt;app_uart_put(&amp;#39;\r&amp;#39;);&lt;/p&gt;
&lt;p&gt;app_uart_put(&amp;#39;\n&amp;#39;);&lt;/p&gt;
&lt;p&gt;So sending should be fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;
&lt;p&gt;Rafaello&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 Processing of received UART data</title><link>https://devzone.nordicsemi.com/thread/198150?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2019 11:55:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a846cb8c-1373-4892-8833-5475d9cb9045</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Rafaello&lt;/p&gt;
&lt;p&gt;If I understand you correctly the issue is not to find the +CGNSPWR=0 string, but that the data in the finale buffer is not correct after reception?&lt;/p&gt;
&lt;p&gt;The way you &amp;#39;clean&amp;#39; the buffer seems overly complicated in my opinion. It should be sufficient either to just clear all the 100 bytes before you copy data to finale, or to clear the remaining bytes of finale after you have copied the data. Also, I would expect you to want to clean the bytes that you don&amp;#39;t overwrite with data, there is no point clearing the bytes that you are about to overwrite anyway.&lt;/p&gt;
&lt;p&gt;I would expect it to look something like this:&lt;/p&gt;
&lt;p&gt;for (uint32_t i = 0; i &amp;lt; count; i++)&lt;br /&gt; {&lt;br /&gt;&amp;nbsp; finale[i] = data[i]; &lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;for(uint32_t i = count; i &amp;lt; 100; i++)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; finale[i] = 0;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;And if you still have issues I would suggest putting some logging into the function so that you can see exactly which bytes are received at any one time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>