<?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>Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22740/trouble-to-read-write-and-activate-notification</link><description>Hello comunnity, 
 I am trying to read, write and activite notification from my server using a central device. The problem is when I use more than 2 times, I got an error of NRF_ERROR_INVALID_DATA
But When i do it separetly the code works.
 
 I attached</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Jun 2017 09:00:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22740/trouble-to-read-write-and-activate-notification" /><item><title>RE: Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/thread/89399?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2017 09:00:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8334ab12-6884-4a64-80de-48af3ebc70e3</guid><dc:creator>DavidC</dc:creator><description>&lt;p&gt;Thanks! it was so usefull!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/thread/89400?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2017 08:38:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0b2f361-c0cf-449a-aa7d-fb8ab9534a01</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When calling &lt;code&gt;sd_ble_gattc_write&lt;/code&gt; you will get a &lt;code&gt;BLE_EVT_TX_COMPLETE&lt;/code&gt; / &lt;code&gt;BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&lt;/code&gt; when the packet has been transmitted for write commands(write without response). For write requests you will get a &lt;code&gt;BLE_GATTC_EVT_WRITE_RSP&lt;/code&gt; when the packet is received by the peer.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sd_ble_gattc_write()&lt;/code&gt; will return &lt;code&gt;NRF_SUCCESS&lt;/code&gt; when it has started the write procedure. When you are doing write request you it will return &lt;code&gt;NRF_ERROR_BUSY&lt;/code&gt;(=0x11) if a write request procedure is already ongoing,e.g. you have not received a &lt;code&gt;BLE_GATTC_EVT_WRITE_RSP&lt;/code&gt; for your previous write request.&lt;/p&gt;
&lt;p&gt;Only one write with response procedure can be ongoing per connection at a time. If the application tries to write with response while another write with response procedure is ongoing, the function call will return &lt;code&gt;NRF_ERROR_BUSY&lt;/code&gt;. Either wait for the event &lt;code&gt;BLE_GATTC_EVT_WRITE_RSP&lt;/code&gt; before calling &lt;code&gt;sd_ble_gattc_write()&lt;/code&gt;, or do  Write without Response.&lt;/p&gt;
&lt;p&gt;Relevant Message Sequence Chart:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/msc_5F00_inline_5F00_mscgraph_5F00_63.png" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/thread/89398?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 09:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc208894-0779-4ff6-8f79-6c3acef7949b</guid><dc:creator>DavidC</dc:creator><description>&lt;p&gt;it doesn´t matter in which order i put them, the first will work correctly but the second and the third will have an error&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/thread/89397?ContentTypeID=1</link><pubDate>Wed, 14 Jun 2017 12:57:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:071a8609-497a-4ea5-971f-10cb901498b7</guid><dc:creator>DavidC</dc:creator><description>&lt;p&gt;Hi Sigurd,
the funcions that I am using are the followin:
Activating the notifications:
err_code = sd_ble_gattc_write(m_conn_handle[conn_nummber], &amp;amp;write_params);
Reading:
err_code = sd_ble_gattc_read(m_conn_handle[conn_nummber],FREQUUID,0);&lt;/p&gt;
&lt;p&gt;Set the Freque.
err_code = sd_ble_gattc_write(m_conn_handle[conn_nummber], &amp;amp; write_params_SR);&lt;/p&gt;
&lt;p&gt;uint8_t p_value[2]	= {0x01, 0x01};	/&lt;strong&gt;*/
uint8_t sample_rate = 0x64; /&lt;/strong&gt;*/&lt;/p&gt;
&lt;p&gt;static  ble_gattc_write_params_t const write_params =
{
.write_op 	= BLE_GATT_OP_WRITE_REQ,
.handle		= QUATERNIOSUUID,
.offset		= 0,
.len		= 2,
.p_value	= (uint8_t *)&amp;amp;p_value
};&lt;/p&gt;
&lt;p&gt;static ble_gattc_write_params_t write_params_SR =
{
.write_op 	= BLE_GATT_OP_WRITE_REQ,
.handle		= FREQUUID,
.offset		= 0,
.len 		= sizeof(sample_rate),
.p_value	= (uint8_t *)&amp;amp;sample_rate
};&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble to read, write and activate notification</title><link>https://devzone.nordicsemi.com/thread/89396?ContentTypeID=1</link><pubDate>Wed, 14 Jun 2017 11:09:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b50484b-ce1e-4a8e-8619-457ce044bb67</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What functions are returning the &lt;code&gt;0x11&lt;/code&gt; error code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>