<?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>Cannot read to terminal from UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9955/cannot-read-to-terminal-from-uart</link><description>Hello, 
 I am running the UART app example in SDK 0.9.1 with the nRF52 and PCA 10036. I am using putty to send and receive messages, as well as the nRF UART v2.0 app for Android to receive the data and send data back. Also, I am compiling using Keil</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Oct 2015 23:56:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9955/cannot-read-to-terminal-from-uart" /><item><title>RE: Cannot read to terminal from UART</title><link>https://devzone.nordicsemi.com/thread/36945?ContentTypeID=1</link><pubDate>Fri, 30 Oct 2015 23:56:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44660302-0a1e-40d4-9830-463520d917b4</guid><dc:creator>JudePinto</dc:creator><description>&lt;p&gt;Thank you! That worked perfectly once i powercycled my board&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read to terminal from UART</title><link>https://devzone.nordicsemi.com/thread/36944?ContentTypeID=1</link><pubDate>Thu, 29 Oct 2015 08:16:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f215b677-b44d-4931-9c23-c106db9e54e5</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;When I try it I have to input 20 characters in RealTerm in order to have the data sent to the Android phone. That is because the ble_app_uart application will first send the BLE packet when 20 bytes are received on the UART, specified by the BLE_NUS_MAX_DATA_LEN constant. This is done in line 400 in main.c in the uart_event_handle function. I can set a breakpoint there and it is hit whenever I input a character in RealTerm.&lt;/p&gt;
&lt;p&gt;If I however modify the code to make the data packet be sent whenever a &amp;quot;carrier return&amp;quot; is received, then a packet is sent whenever &amp;quot;Enter&amp;quot; is pressed in RealTerm, i.e. input &amp;quot;abc&amp;quot; then press &amp;quot;enter&amp;quot; and then the three characters are seen in the nRF UART v2.0 app.&lt;/p&gt;
&lt;p&gt;The carrier return has hex code 0x0D but can be detected with \r also in C. So the code is now:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    case APP_UART_DATA_READY:
        UNUSED_VARIABLE(app_uart_get(&amp;amp;data_array[index]));
        index++;

        if ((data_array[index - 1] == &amp;#39;\r&amp;#39;) || (index &amp;gt;= (BLE_NUS_MAX_DATA_LEN)))
        {
            err_code = ble_nus_string_send(&amp;amp;m_nus, data_array, index);
            if (err_code != NRF_ERROR_INVALID_STATE)
            {
                APP_ERROR_CHECK(err_code);
            }
            
            index = 0;
        }
        break;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>