<?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>BT 5.0 on ble_app_uart 2MPHY</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46589/bt-5-0-on-ble_app_uart-2mphy</link><description>Hello All, 
 I have 2 evaluation boards nrf53840 EVB &amp;quot;PCA10056&amp;quot;. 
 I would like to run on them the &amp;quot;ble_app_uart&amp;quot; in &amp;quot; nRF5_SDK_15.3.0_59ac345 &amp;quot; as following: 
 
 A custom board send via uart a buffer for example of 30 characters to the peripheral on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 May 2019 11:42:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46589/bt-5-0-on-ble_app_uart-2mphy" /><item><title>RE: BT 5.0 on ble_app_uart 2MPHY</title><link>https://devzone.nordicsemi.com/thread/184857?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 11:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e085dedb-98de-4915-8931-f59fbee7e0ef</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I suggest you use the NRF_LOG_INFO(); for logging, and printf() for your UART purpose only. Your log is printed in the RTT Log. Have you used RTT Viewer to view this? Or if you use Segger Embedded.&lt;/p&gt;
&lt;p&gt;Where do you see &amp;quot;Fatal&amp;quot;? Is that in the RTT log? If you see &amp;quot;Fatal&amp;quot;, can you please try to define DEBUG in your preprocessor defines? Let me know if you:&lt;/p&gt;
&lt;p&gt;1. Don&amp;#39;t know how to view your log messages (NRF_LOG_INFO()).&lt;/p&gt;
&lt;p&gt;2. Don&amp;#39;t know how to define DEBUG in your preprocessor defines.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you define DEBUG and monitor your log, what does the log say then?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BT 5.0 on ble_app_uart 2MPHY</title><link>https://devzone.nordicsemi.com/thread/184035?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 10:50:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be0780d3-75a6-4107-8f4b-130dc59dc482</guid><dc:creator>Bar1</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The error I get once I send the data with UART to the peripheral is a FIFO ERROR.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BT 5.0 on ble_app_uart 2MPHY</title><link>https://devzone.nordicsemi.com/thread/183825?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 12:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:561188e1-9478-46c2-9c88-9c30f891b280</guid><dc:creator>Bar1</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Today I got some new result that now I try to summarize.&lt;/p&gt;
&lt;p&gt;Before,&amp;nbsp;in the instant which I sent the data at that speed from the other side I saw one, max 2 packets and then disconnected and no longer reconnected ( I will try to dig deeper on this).&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Today, however, I made a small change to the code and in particular I call this function&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;void phy_update_request(ble_evt_t const * p_ble_evt){&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret_code_t err_code;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ble_gap_phys_t const phys =&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.rx_phys = BLE_GAP_PHY_2MBPS,&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.tx_phys = BLE_GAP_PHY_2MBPS,&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;};&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;In the ble_event_handler routine, under the case : BLE_GAP_EVT_CONNECTED in the main.&lt;br /&gt;After that I did that I can see that it is going way better, in fact now from the &amp;quot;central&amp;quot; side (I&amp;#39;m sending data&lt;br /&gt;from a micro-controller via UART to the &lt;span&gt;peripheral) I can see the packets arriving good.&lt;br /&gt;&lt;/span&gt;The problem now is that, if for any reason the connection fails the program from the peripheral goes in Fatal Error and&lt;br /&gt;it remain there, because, even if there is no connection from the &amp;quot;microcontroller&amp;quot; side I am still sending data.&lt;br /&gt;In fact, if I stop the data streaming, the program exits from the error routine and starts again.&lt;br /&gt;So at this point I thought how let the micro know when there is a connection&lt;br /&gt;(via a message on the UART - printf (&amp;quot;BLE Connection OK&amp;quot;), in the connection routine) and when there is no connection.&lt;br /&gt;&lt;br /&gt; switch (p_ble_evt-&amp;gt;header.evt_id)&lt;br /&gt; {&lt;br /&gt;        case BLE_GAP_EVT_CONNECTED:&lt;br /&gt;             NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);&lt;br /&gt;&lt;br /&gt;             &lt;strong&gt;printf(&amp;quot;\r\nBLE CONNECTION ON\r\n&amp;quot;);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;             err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);&lt;br /&gt;             APP_ERROR_CHECK(err_code);&lt;br /&gt;             m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;&lt;br /&gt;             err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);&lt;br /&gt;             APP_ERROR_CHECK(err_code);&lt;br /&gt;&lt;br /&gt;             phy_update_request(p_ble_evt);&lt;br /&gt;             break;&lt;br /&gt;&lt;br /&gt;        case BLE_GAP_EVT_DISCONNECTED:&lt;br /&gt;&lt;br /&gt;             &lt;strong&gt;printf(&amp;quot;\r\nBLE CONNECTION OFF\r\n&amp;quot;);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The problem is that in the BLE_GAP_EVT_DISCONNECTED routine, only the first character of the string is printed and then returns to the error routine.&lt;br /&gt;at this point I thought of putting a print on the UART in the error routine:&lt;br /&gt;&lt;br /&gt;__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)&lt;br /&gt;{&lt;br /&gt;    __disable_irq();&lt;br /&gt;    NRF_LOG_FINAL_FLUSH();&lt;br /&gt;&lt;br /&gt;    #ifndef DEBUG&lt;br /&gt;       &lt;strong&gt;printf(&amp;quot;DISCONNECTED\n&amp;quot;);&lt;/strong&gt;&lt;br /&gt;       NRF_LOG_ERROR(&amp;quot;Fatal error&amp;quot;);&lt;br /&gt;    #else&lt;br /&gt;      switch (id)&lt;br /&gt;          .....&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In this case I always have the same problem (it prints only the first character), but prints it several times&lt;br /&gt;consecutive (enters several times in the error routine). In this way, I thought in setting a character&lt;br /&gt;(for example -&amp;gt; &amp;quot;*&amp;quot; instead of &lt;strong&gt;printf(&amp;quot;DISCONNECTED\n&amp;quot;)&lt;/strong&gt;), and once I get, for example, 5 &amp;quot;*&amp;quot; in row I have to stop the streaming from the micro controller side.&lt;/pre&gt;
&lt;pre&gt;&lt;br /&gt;However I don&amp;#39;t like this approach so much and I was wondering if there is a way to avoid the problem upstream,&lt;br /&gt;that is maybe to interrupt the reading on the UART when the connection has not yet happened.&lt;br /&gt;&lt;br /&gt;What do you think about this?&lt;br /&gt;&lt;br /&gt;Anyway thank a lot for your help and your time.&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BT 5.0 on ble_app_uart 2MPHY</title><link>https://devzone.nordicsemi.com/thread/183794?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 12:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79846d21-d67e-4c97-8d6d-4b1dc6ea1282</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;What is your disconnect reason on the nRFs (on both)?&lt;/p&gt;
&lt;p&gt;My guess is that one of them is caught in an APP_ERROR_CHECK(err_code) with err_code != 0, and the other one receives a supervision timeout?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Try to define DEBUG in your preprocessor defines, and look at your RTT log (make sure that NRF_LOG_ENABLED is set to 1 in sdk_config.h, and that NRF_LOG_BACKEND_RTT_ENABLED is 1.&lt;/p&gt;
&lt;p&gt;Do this, and monitor your log. Does any of the devices say anything useful in the log?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>