<?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>Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79989/stop-ble_app_uart-connection-with-ble_app_uart_c</link><description>I am using: \examples\ble_peripheral\ble_app_uart and \examples\ble_central\ble_app_uart_c . 
 In Nordic infocenter it says: The application scans peripheral devices and connects to a device that advertises with the NUS UUID in its advertisement report</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Oct 2021 12:54:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79989/stop-ble_app_uart-connection-with-ble_app_uart_c" /><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/334165?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 12:54:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dab3cab-6705-47bb-8d6a-2dc5578201d4</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;Thanks Vidar. That fixed the problem and it is now working.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/334152?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 12:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99a370f8-3c08-4186-9407-06849a8b1eed</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The UART driver is returning invalid state because you are application is trying to initialize the same UARTE instance twice, once by the logger module, and the other by the application (uart_init() in main). The solution is to only use RTT for logging and disable the UART logger backend by setting NRF_LOG_BACKEND_UART_ENABLED to &amp;#39;0&amp;#39; in sdk_config.h&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/334150?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 12:35:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3566b58d-ef7a-4afa-8099-e26b5fbeb665</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;Thanks Vidar.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For peripheral I get this in the debug terminal:&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE] at ...\nRF5_SDK_17.0.2_d674dde\components\libraries\log\src\nrf_log_backend_uart.c:67&lt;br /&gt;PC at: 0x000314CF&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/p&gt;
&lt;p&gt;I set&amp;nbsp;NRF_LOG_BACKEND_UART_ENABLED=0 in sdk_config and that seems to fix the issue. Now my peripheral device is blinking normal in scan mode. Please confirm.&lt;/p&gt;
&lt;p&gt;For central I get this in the debug terminal:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE] at ...\nRF5_SDK_17.0.2_d674dde\examples\My Projects\uart_central_wpmg_3\main.c:956&lt;br /&gt;PC at: 0x00035A03&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/334032?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 06:22:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d59062d-4363-4930-81a5-383512757f49</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please select the &amp;quot;Debug&amp;quot; build configuration when debugging your project. This configuration includes the DEBUG flag which will make the error handler in &lt;span&gt;app_error_weak.c print a more detailed error message. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1634192460879v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/334000?ContentTypeID=1</link><pubDate>Wed, 13 Oct 2021 16:02:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad1b19e6-6c46-4cfe-8a88-dded751226ae</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;&amp;nbsp;removed&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_SYS_ATTR_MISSING and BLE_GAP_EVT_SEC_PARAMS_REQUEST from both central and peripheral codes in ble_evt_handlers.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My central keeps resetting and prints this in COM port:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;br /&gt;&amp;lt;warning&amp;gt; app: System reset&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is what appears in central code Debug terminal:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE]&amp;nbsp;&lt;br /&gt;PC at: 0x00035A03&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My peripheral&amp;nbsp;does not print anything to the COM port. It is expected to print:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Peripheral UART Started.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For peripheral this appears in the debug terminal:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For both peripheral and central, debugger stops at:&amp;nbsp;NRF_BREAKPOINT_COND in app_error_weak.c&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/333932?ContentTypeID=1</link><pubDate>Wed, 13 Oct 2021 12:19:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e21b79e9-bdd2-48cf-9be2-daf1aa470912</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You need to remove the event handling for BLE_GATTS_EVT_SYS_ATTR_MISSING and BLE_GAP_EVT_SEC_PARAMS_REQUEST from your ble_evt_handlers as these are being handled by the peer manager. Apart from that it looks good.&lt;/p&gt;
&lt;p&gt;Do you have any debug logs from the central? Is it able to discover the NUS peripheral at all?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/333806?ContentTypeID=1</link><pubDate>Wed, 13 Oct 2021 00:23:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4e148fb-d100-4012-a1cd-58288d090a62</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;I have modified&amp;nbsp;ble_app_uart and&amp;nbsp;ble_app_uart_c codes by adding peer manager modules to it and compiles successfully. But it does not seem my devices connect any more after adding peer manager and send and receive serial data from one to the other. Can you give me any idea what could be wrong here.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/332473?ContentTypeID=1</link><pubDate>Tue, 05 Oct 2021 07:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:407a25fd-83be-4024-87be-bdf42440abe8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The encryption key will be added through the pairing procedure which initiated by the GAP central when it calls &lt;span&gt;&lt;a title="pm_conn_secure" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__peer__manager.html?cp=8_1_6_2_16_39#ga46dfaf46c0aa94fc15017d42b3a2e514"&gt;pm_conn_secure&lt;/a&gt;&lt;/span&gt;().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/332439?ContentTypeID=1</link><pubDate>Mon, 04 Oct 2021 20:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a046bbbf-f537-4036-904f-004de1e2fa6a</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;Ok, thanks. I am using&amp;nbsp;&lt;span&gt;ble_app_hrs for peripheral and&amp;nbsp;ble_app_hrs_c for central device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In these codes seems there are&amp;nbsp;SEC_PARAM_MIN_KEY_SIZE and&amp;nbsp;SEC_PARAM_MAX_KEY_SIZE for encryption key size, but how can I set/update encryption key itself?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/331389?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 18:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:284b1ce8-86f0-4944-afe4-9c048c1d9905</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Most of the BLE examples do. Easiest way to tell if an example supports pairing or bonding is to check if it calls peer_manager_init() in main().&lt;/p&gt;
&lt;p&gt;But what is your requirement for this, is it to be able to encrypt the connection? In that case, it will be easier to add the NUS service to another example such as ble_app_hrs that already support pairing than it will be to add the peer manager to the NUS example. This is because there will be fewer&amp;nbsp; source files, include paths and sdk_config settings to add.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/331377?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 16:51:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5196d006-4b96-40f3-9fcd-c5c54e5fa2ef</guid><dc:creator>Kaveh.M</dc:creator><description>&lt;p&gt;Thanks Vidar. Is there any example that implements peer manager modules?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if NUS does not work with encryption and peer manager, how do I trans/receive data after encryption implementation? Which SDK modules I can use to communicate data between my two devices after connection encryption?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop ble_app_uart connection with ble_app_uart_c</title><link>https://devzone.nordicsemi.com/thread/331217?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 07:32:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ed6d078-a347-46db-bd70-483aa7a5a8b0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;1. Pairing is a procedure that&amp;#39;s performed after a connection is established to secure the connection. But pairing is not supported by the NUS example which means the link will always be unencrypted. The SDK examples that support BLE security include the &lt;span&gt;&lt;a title="Peer Manager" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_peer_manager.html?cp=8_1_3_2_7"&gt;Peer Manager&lt;/a&gt;&lt;/span&gt; module.&lt;/p&gt;
&lt;p&gt;2. You can use the low-power &lt;span&gt;&lt;a title="Timer library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_timer.html?cp=8_1_3_53"&gt;Timer library&lt;/a&gt;&lt;/span&gt; to trigger periodic events to start connectable advertising and/or terminate a connection.&lt;/p&gt;
&lt;p&gt;Softdevice function to terminate a connection:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;            err_code = sd_ble_gap_disconnect(conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Required change in advertising_init() to prevent the advertising module from automatically re-starting connectable advertising on disconnect:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing the Advertising functionality.
 */
static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = false;
    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
    /* Don&amp;#39;t restart advertising on discoonect */
    init.config.ble_adv_on_disconnect_disabled = true; 
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>