<?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>Unable to receive notifications from peripheral after reconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51531/unable-to-receive-notifications-from-peripheral-after-reconnect</link><description>Hello everyone, I am using an nrf52840 development board with the NUS UART Central example from the SDKv15.3.0 packet as the code basis. I am also using the s140 softdevice. I have a custom service which is exactly the same as the ble_nuc_c service but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Aug 2019 15:55:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51531/unable-to-receive-notifications-from-peripheral-after-reconnect" /><item><title>RE: Unable to receive notifications from peripheral after reconnect</title><link>https://devzone.nordicsemi.com/thread/206937?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 15:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af77cfaf-cf9a-4e81-921d-0f64b0bcf526</guid><dc:creator>alcalaj</dc:creator><description>&lt;p&gt;Hello again everyone,&lt;/p&gt;
&lt;p&gt;After looking through the code thoroughly, I figured out that the error was actually in my added code and not the in the ble nus code. The central was able to connect, disconnect and reconnect correctly. The error was that when I send the data string to the peripheral, I calculate a checksum using a temporary variable which should then get cleared after the checksum is sent. My mistake was that I was not clearing the temporary value and therefore, an incorrect checksum was being sent to the peripheral after a reconnect.&lt;/p&gt;
&lt;p&gt;Sorry for taking up some of your time on an error that was completely my fault and not a ble issue. But also thank you for taking time to look at my question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to receive notifications from peripheral after reconnect</title><link>https://devzone.nordicsemi.com/thread/206922?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 14:27:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba4065e2-3430-4301-b8c7-deb4a4702ad4</guid><dc:creator>alcalaj</dc:creator><description>&lt;p&gt;Thanks for the reply!&lt;/p&gt;
&lt;p&gt;Yes, I am using the &lt;strong&gt;ble_nus_data_send()&lt;/strong&gt; and &lt;strong&gt;ble_nus_c_data_send().&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I used the &lt;strong&gt;SEGGER_RTT_printf()&lt;/strong&gt; function to print out the ble events that occur in my program:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When notifications don&amp;#39;t show up on the device I get event BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&lt;/p&gt;
&lt;p&gt;and then the program waits for the next event which never comes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When I do get notifications on the first connection, I get the event:&lt;/p&gt;
&lt;p&gt;BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&lt;/p&gt;
&lt;p&gt;followed by the event:&lt;/p&gt;
&lt;p&gt;BLE_GATTC_EVT_HVX&lt;/p&gt;
&lt;p&gt;which then triggers the UART print events.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if this will help but here is the complete list of ble events that occur from the first connection and correct transfer of data until the second connection when the data transfer fails.&lt;/p&gt;
&lt;p&gt;I used &lt;strong&gt;SEGGER_RTT_printf()&lt;/strong&gt; in the function &lt;strong&gt;nrf_sdh_ble_evts_poll()&lt;/strong&gt; to print the ble events as they occur. I have listed the event id and enumeration name. I have also added notes that hopefully make the work flow clear:&lt;/p&gt;
&lt;p&gt;DEBUG STARTS&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;BLE event: 0x1D.&amp;nbsp; BLE_GAP_EVT_ADV_REPORT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Scanning&lt;br /&gt;BLE event: 0x10. &amp;nbsp; BLE_GAP_EVT_CONNECTED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Peripheral is found&lt;br /&gt;&lt;br /&gt;BLE event: 0x24.&amp;nbsp;&amp;nbsp; BLE_GAP_EVT_DATA_LENGTH_UPDATE&lt;br /&gt;BLE event: 0x3A.&amp;nbsp;&amp;nbsp; BLE_GATTC_EVT_EXCHANGE_MTU_RSP&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;BLE event: 0x30. BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP&lt;br /&gt;BLE event: 0x32. BLE_GATTC_EVT_CHAR_DISC_RSP&lt;br /&gt;BLE event: 0x32. BLE_GATTC_EVT_CHAR_DISC_RSP&lt;br /&gt;BLE event: 0x33. BLE_GATTC_EVT_DESC_DISC_RSP&lt;br /&gt;BLE event: 0x30. BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; NUS service discovered&lt;/p&gt;
&lt;p&gt;Connected to device with NUS Comm Service.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Debug message I use to indicate connection&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLE event: 0x38. BLE_GATTC_EVT_WRITE_RSP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== cccd configured to enable notifications on peripheral&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;BLE event: 0x1F. BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST&lt;br /&gt;BLE event: 0x12. BLE_GAP_EVT_RSSI_CHANGED&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Data hex: 0x54 68 69 73 20 69 73 20 61 20 6d 65 73 73 61 67 65 20 34 75 &amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Random data string that I send&lt;br /&gt;BLE event: 0x3C. BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== data is sent&lt;br /&gt;BLE event: 0x39. BLE_GATTC_EVT_HVX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== central receives a notification with reply string&lt;/p&gt;
&lt;p&gt;Receiving data from KN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== Name of our peripheral&lt;br /&gt;Data hex: 0x54 68 69 73 20 69 73 20 61 20 72 65 70 6c 79 20 34 75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== Reply string of random data&lt;br /&gt;&lt;br /&gt;BLE event: 0x11. BLE_GAP_EVT_DISCONNECTED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== Peripheral disconnects&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;BLE event: 0x1D. BLE_GAP_EVT_ADV_REPORT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Scanning &lt;br /&gt;BLE event: 0x10. BLE_GAP_EVT_CONNECTED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== Peripheral is found again and connects for the second time&lt;br /&gt;&lt;br /&gt;BLE event: 0x11. BLE_GAP_EVT_DISCONNECTED&amp;nbsp; &amp;lt;== Peripheral disconnects (this doesn&amp;#39;t always happen)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLE event: 0x1D. BLE_GAP_EVT_ADV_REPORT&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Scanning&amp;nbsp;&lt;br /&gt;BLE event: 0x10. BLE_GAP_EVT_CONNECTED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== Peripheral is found again connects for the third time&lt;br /&gt;&amp;nbsp;&lt;br /&gt;BLE event: 0x24. BLE_GAP_EVT_DATA_LENGTH_UPDATE&lt;br /&gt;BLE event: 0x3A. BLE_GATTC_EVT_EXCHANGE_MTU_RSP&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLE event: 0x30. BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP&lt;br /&gt;BLE event: 0x32. BLE_GATTC_EVT_CHAR_DISC_RSP&lt;br /&gt;BLE event: 0x32. BLE_GATTC_EVT_CHAR_DISC_RSP&lt;br /&gt;BLE event: 0x33. BLE_GATTC_EVT_DESC_DISC_RSP&lt;br /&gt;BLE event: 0x30. BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP&amp;nbsp; &amp;lt;==&amp;nbsp; NUS service discovered&lt;/p&gt;
&lt;p&gt;Connected to device with NUS Comm Service.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Debug message I use to indicate connection&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLE event: 0x38. BLE_GATTC_EVT_WRITE_RSP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== cccd configured to enable notifications on peripheral&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;BLE event: 0x1F. BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST&lt;br /&gt;BLE event: 0x12. BLE_GAP_EVT_RSSI_CHANGED&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Data hex: 0x54 68 69 73 20 69 73 20 61 20 6d 65 73 73 61 67 65 20 34 75&amp;nbsp;&amp;nbsp; &amp;lt;==&amp;nbsp; Random data string that I send &lt;br /&gt;BLE event: 0x3C. BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;== data is sent&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is where the events stop occurring. On subsequent events, I don&amp;#39;t receive BLE_GATTC_EVT_HVX events which makes me believe that notifications might not actually enabled on the peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to receive notifications from peripheral after reconnect</title><link>https://devzone.nordicsemi.com/thread/206855?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 12:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b2d720c-7fcb-41fd-bba4-51dd4495ed47</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Enabling notifications is only necessary to be able to send notifications from peripheral to central, not the other way around.&lt;/p&gt;
&lt;p&gt;I assume that you are using the functions ble_nus_data_send() and ble_nus_c_data_send() to send data between the devices, right?&lt;/p&gt;
&lt;p&gt;Can you check what that call returns when the notifications doesn&amp;#39;t show up on the other device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>