<?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>Write request vs. indications</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33950/write-request-vs-indications</link><description>Hello :) 
 I have a question about the timing of sending a bluetooth write request. I am using two nrf52 developement kits, one as master and one as slave. From my master device I send a write request using sd_ble_gattc_write. On my slave device this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 May 2018 15:19:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33950/write-request-vs-indications" /><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/131390?ContentTypeID=1</link><pubDate>Tue, 08 May 2018 15:19:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0abc691-5ed5-4ccc-bc6f-06f33f7d5726</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Do you have the possiblity to use the nRF sniffer and compare the two setups? Then we may identify the excact cause.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Sniffer/(language)/eng-GB"&gt;https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Sniffer/(language)/eng-GB&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You may also print all the BLE events to see if there is an event occuring here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/131032?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 13:30:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d39f7846-14ab-4268-9214-8dd54599b0d8</guid><dc:creator>Sofie606</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;The timing problem is solved now, it had to do with my own timers I set wrong.&lt;/p&gt;
&lt;p&gt;Unfortunately I have a new problem now.&lt;/p&gt;
&lt;p&gt;When I write to my slave device, I don&amp;#39;t get a&amp;nbsp;&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_WRITE event anymore, on my slave device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am still writing from my master device with sd_ble_gattc_write and I still get a&amp;nbsp;BLE_GATTC_EVT_WRITE_RSP event, on my master device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried writing to my slave device with the Master Control Panel. When I do that the BLE_GATTS_EVT_WRITE does occur. So I think it&amp;#39;s my master device which has the problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here is my code from my master device:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;tx_wrs_message_t * p_msg;
uint16_t       cccd_val = true ? BLE_GATT_HVX_NOTIFICATION : 0;
   
p_msg              = &amp;amp;m_tx_wrs_buffer[m_tx_wrs_insert_index++];
m_tx_wrs_insert_index &amp;amp;= TX_WRS_BUFFER_MASK;
     
uint16_t wrs_write_handle = p_ble_write_request-&amp;gt;peer_write_db.wrs_write_handle;
    
    
p_msg-&amp;gt;req.write_req.gattc_params.handle   = wrs_write_handle;
p_msg-&amp;gt;req.write_req.gattc_params.len      = WRITE_WRS_MESSAGE_LENGTH;
p_msg-&amp;gt;req.write_req.gattc_params.p_value  = p_msg-&amp;gt;req.write_req.gattc_value;
p_msg-&amp;gt;req.write_req.gattc_params.offset   = 0;
p_msg-&amp;gt;req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
p_msg-&amp;gt;req.write_req.gattc_value[0]        = LSB_16(cccd_val);
p_msg-&amp;gt;req.write_req.gattc_value[1]        = MSB_16(cccd_val);
p_msg-&amp;gt;conn_handle                         = p_ble_write_request-&amp;gt;conn_handle;
p_msg-&amp;gt;type                                = WRITE_REQ_WRS;
    
   
if (m_tx_wrs_index != m_tx_wrs_insert_index)
{
          sd_ble_gattc_write(m_tx_wrs_buffer[m_tx_wrs_index].conn_handle,
                                          &amp;amp;m_tx_wrs_buffer[m_tx_wrs_index].req.write_req.gattc_params);
                   
          m_tx_wrs_index++;
          m_tx_wrs_index &amp;amp;= TX_WRS_BUFFER_MASK;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What could I be doing wrong?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you please help me?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/130922?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 07:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2a302af-1152-4ae8-9a9b-1af7ac180520</guid><dc:creator>Sofie606</dc:creator><description>&lt;p&gt;Hello Kenneth,&lt;/p&gt;
&lt;p&gt;I need a response for my program. It&amp;#39;s okay that it is slow, if I can estimate the time it takes :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/130852?ContentTypeID=1</link><pubDate>Thu, 03 May 2018 15:03:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e0fa63f-4fd2-4310-ba67-5aca43108d07</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;BLE_GATT_OP_WRITE_REQ is by design slow, since it rely BLE_GATTC_EVT_WRITE_RSP from the peer. I recommend to use the&amp;nbsp;BLE_GATT_OP_WRITE_CMD instead if you need faster throughput.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/130733?ContentTypeID=1</link><pubDate>Thu, 03 May 2018 07:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26a5724f-4eac-4250-a080-e81c626bd154</guid><dc:creator>Sofie606</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;Thank you for your reaction.&lt;/p&gt;
&lt;p&gt;I used the message sequence charts to explain what I mean.&lt;/p&gt;
&lt;p&gt;The first image shows the timings I measured when I was sending an indication with sd_ble_gatts_hvx.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The time between sending the packet and receiving it on my central (client) was variable between 0 to 10 ms, just like I expected it would be. And the time between receiving the packet on my central (client) and getting the acknowlegde on my slave (server) took one connection interval (10ms) every time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Timing-Indication-and-Att-response.png" /&gt;&lt;/p&gt;
&lt;p&gt;This is what I would expect to happen. And I also thought it would happen if I did it the other way around using a write request. But when I measured the time it took from sending the message from my central (client) to receiving it on my slave (server) it was one connection interval (10ms) every time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/communityserver-discussions-components-files/4/Timing-Write-request-and-Att-response.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is my code for calling sd_ble_gattc_write():&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;tx_message_t * p_msg;
    
uint16_t       cccd_val = true ? BLE_GATT_HVX_NOTIFICATION : 0;
    
p_msg              = &amp;amp;m_tx_buffer[m_tx_insert_index++];
m_tx_insert_index &amp;amp;= TX_BUFFER_MASK;

uint16_t cccd_handle = p_ble_write_request-&amp;gt;conn_handle;

p_msg-&amp;gt;req.write_req.gattc_params.handle   = cccd_handle;
p_msg-&amp;gt;req.write_req.gattc_params.len      = WRITE_MESSAGE_LENGTH;
p_msg-&amp;gt;req.write_req.gattc_params.p_value  = p_msg-&amp;gt;req.write_req.gattc_value;
p_msg-&amp;gt;req.write_req.gattc_params.offset   = 0;
p_msg-&amp;gt;req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
p_msg-&amp;gt;req.write_req.gattc_value[0]        = LSB_16(cccd_val);
p_msg-&amp;gt;req.write_req.gattc_value[1]        = MSB_16(cccd_val);
p_msg-&amp;gt;conn_handle                         = p_ble_write_request-&amp;gt;conn_handle;
p_msg-&amp;gt;type                                = WRITE_REQ;
    
if (m_tx_index != m_tx_insert_index)
{
    sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle,
                                          &amp;amp;m_tx_buffer[m_tx_index].req.write_req.gattc_params);
    m_tx_index++;
    m_tx_index &amp;amp;= TX_BUFFER_MASK;
    
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Should the timings be the same of indication and write request?&lt;/p&gt;
&lt;p&gt;Thank you :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request vs. indications</title><link>https://devzone.nordicsemi.com/thread/130653?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 16:06:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a739d9d-eeaf-49f2-ade0-b521270189c2</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The message sequence chart is as shown here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_c___m_s_c.html?cp=2_3_1_1_1_2_2_3"&gt;http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_c___m_s_c.html?cp=2_3_1_1_1_2_2_3&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What parameters are you using when calling&amp;nbsp;sd_ble_gattc_write(.....)?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>