<?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>Application of BLE UART Console on 51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17389/application-of-ble-uart-console-on-51822</link><description>I have a nRF51822 custom board for BLE UART application. Connects this to serial port of an ARM SoC board.
P0.09 is for UART_Tx and P0.11 is for UART_Rx. No RTS and CTS are used. 
 Build examples/ble_peripheral/ble_app_uart for PCA10001 based on nRF5_SDK_12</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Nov 2016 13:31:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17389/application-of-ble-uart-console-on-51822" /><item><title>RE: Application of BLE UART Console on 51822</title><link>https://devzone.nordicsemi.com/thread/66849?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2016 13:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f18023b-a528-4e74-9e7b-115d9eb0f35e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The function &lt;code&gt;uart_event_handle()&lt;/code&gt; receives the characters you send on the terminal, and then sends the characters as a string to the phone. The function splits the string into 20 bytes blocks, so you will have no problem sending a single string of more than 20 bytes to the phone, as long as you don’t send it too often (overflow the buffers). After you have sent the string to the phone, you will get the event &lt;code&gt;BLE_EVT_TX_COMPLETE&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The problem is when you try to send strings longer than 20 bytes from the phone to the nRF51, since the example does not use read long characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application of BLE UART Console on 51822</title><link>https://devzone.nordicsemi.com/thread/66848?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 18:46:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51f9a458-4bf3-451c-8d58-a7c0a9b4ea27</guid><dc:creator>henry</dc:creator><description>&lt;p&gt;Sigurd,&lt;/p&gt;
&lt;p&gt;Look at main.c in ble_app_uart subdirectory in nRF5_SDK_12.1.0_0d23e2a&lt;/p&gt;
&lt;p&gt;void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
static uint8_t index = 0;
uint32_t       err_code;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;switch (p_event-&amp;gt;evt_type)
{
    case APP_UART_DATA_READY:
        UNUSED_VARIABLE(app_uart_get(&amp;amp;data_array[index]));
        index++;

        if ((data_array[index - 1] == &amp;#39;\n&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;p&gt;Above does split 20 bytes and sends to UART.&lt;/p&gt;
&lt;p&gt;Some posts suggest to check BLE_EVT_TX_COMPLETE as:&lt;/p&gt;
&lt;p&gt;void on_ble_evt(ble_evt_t * p_ble_evt) {
switch (p_ble_evt-&amp;gt;header.evt_id){&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;             case BLE_EVT_TX_COMPLETE: 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Call is not hit at &amp;quot;case BLE_EVT_TX_COMPLETE&amp;quot; when text messages are sent from serial console to nRF51822. But does hit it when send message from Android phone to nRF51822.&lt;/p&gt;
&lt;p&gt;Is there any reference code around?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application of BLE UART Console on 51822</title><link>https://devzone.nordicsemi.com/thread/66847?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2016 09:30:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa8512af-25ec-4199-aafd-3414f26c83fe</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;It is (currently) not possible to transmit more than 20 bytes of data per package between a nRF51/52 and Android. So you will need to &amp;quot;split&amp;quot; the data you want to send in 20 bytes packets.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>