<?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 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23334/nrf51822-ble-disconnection-problem</link><description>Hi, I&amp;#39;m using nrf51822 and ble_app_uart(SDK 12.3.0) 
 What I want to do is connect my board with nrf51822 and send data over UART 
 and send data to smartphone over BLE 
 UART data comes about 50bytes/sec 
 My problem is BLE connection is keep disconnected</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jul 2017 08:12:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23334/nrf51822-ble-disconnection-problem" /><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91740?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2017 08:12:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c20b22ec-f4c3-430c-818b-d62a049ae905</guid><dc:creator>DragonAnger</dc:creator><description>&lt;p&gt;Thank you for your answer! I found out that BLE diconnected because of reset like you said. I&amp;#39;m trying to find what causes reset. But, It&amp;#39;s little weird because I almost didn&amp;#39;t change example code ble_app_uart in SDK12.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91741?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 14:43:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24500f2f-657d-4f27-8d6f-5f09e427eee1</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I think you are getting an error somewhere which resets the chip. After reset you are not connected anymore, and you have an invalid connection handle. See if you get an error anywhere, see &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;this&lt;/a&gt; for more info.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91739?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 02:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:602d9c6e-3379-4f32-b635-0f1818ce9e27</guid><dc:creator>DragonAnger</dc:creator><description>&lt;p&gt;In addition, in function ble_nus_string_send()&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    if ((p_nus-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_nus-&amp;gt;is_notification_enabled))
{
		SEGGER_RTT_WriteString(0, &amp;quot;NRF_ERROR_INVALID_STATE\n&amp;quot;);
    return NRF_ERROR_INVALID_STATE;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;NRF_ERROR_INVALID_STATE occurs because of BLE_CONN_HANDLE_INVALID&lt;/p&gt;
&lt;p&gt;And when BLE connected with my phone, at on_ble_evt() in main.c&lt;/p&gt;
&lt;p&gt;BLE_GAP_EVT_CONNECTED occurs.&lt;/p&gt;
&lt;p&gt;When BLE connection is fine, If I press disconnect button in android app to disconnect on purpose, BLE_GAP_EVT_DISCONNECTED occurs.&lt;/p&gt;
&lt;p&gt;But When BLE disconnected abnormally. BLE_GAP_EVT_DISCONNECTED didn&amp;#39;t occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91738?ContentTypeID=1</link><pubDate>Sun, 09 Jul 2017 03:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a897ca7b-98ab-44d2-bafa-8c3de16dae90</guid><dc:creator>DragonAnger</dc:creator><description>&lt;p&gt;I found some details about this problem.&lt;/p&gt;
&lt;p&gt;When BLE disconnected, at this code&lt;/p&gt;
&lt;p&gt;err_code = ble_nus_string_send(&amp;amp;m_nus, data_array, index);&lt;/p&gt;
&lt;p&gt;NRF_ERROR_INVALID_STATE occurs.&lt;/p&gt;
&lt;p&gt;When it occurs, data didn&amp;#39;t come to my android phone.&lt;/p&gt;
&lt;p&gt;When it didn&amp;#39;t occur, data comes to my phone fine.&lt;/p&gt;
&lt;p&gt;Before NRF_ERROR_INVALID_STATE occurs,&lt;/p&gt;
&lt;p&gt;app_uart_init() function in app_uart_fifo.c called couple of times&lt;/p&gt;
&lt;p&gt;and soon BLE disconnected&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91737?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 14:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18919b69-a83f-4ee8-b61c-60848ba22c29</guid><dc:creator>DragonAnger</dc:creator><description>&lt;p&gt;I changed pins to connect with my custom board and nrf51822(+ble400). Before that, I tested with my PC and nrf51822 using USB and BLE with my smartphone(android), and it worked fine. UART data comes every seconds. It can affect BLE connection?
Or it could be android side problem?
I&amp;#39;m using android app nRF UART v2.0 and nRF Toolbox but both have problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91736?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 09:10:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a714e60-7fb1-4a56-9ea0-ce0b025317b4</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;So before you change the pins everything worked fine? Is this a custom board or a nRF51 DK? Are you sure that you don&amp;#39;t get any error code somewhere? That resets the chip?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 BLE disconnection problem</title><link>https://devzone.nordicsemi.com/thread/91742?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 08:14:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8afd0794-4bb1-4992-a002-3657f79bec66</guid><dc:creator>DragonAnger</dc:creator><description>&lt;p&gt;And I changed pca10028.h Pin number for wire UART CONNECTION&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define RX_PIN_NUMBER  11
#define TX_PIN_NUMBER  9

to

#define RX_PIN_NUMBER  5
#define TX_PIN_NUMBER  6
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;after I changed pin number to use wired UART, BLE disconnection problem happened.
Before that, I used just keyboard input over USB-UART. It works fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>