<?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>Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7283/multiple-characteristics-and-notifications</link><description>Hi Forum, 
 i&amp;#39;ve started the development of an custom service on a nrf51822 with s110.
The Service contains 4 Characteristics where notifications are enabled. 
 At the central side i use a nrf51822 with s120.
On this Device the multilink_central app</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Mar 2018 14:37:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7283/multiple-characteristics-and-notifications" /><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/126142?ContentTypeID=1</link><pubDate>Tue, 27 Mar 2018 14:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c51c3659-867b-4ef3-b2a5-6a9fadcbdc1a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;This is a 3 years old case. Please create a new case with information about your setup and debug.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/126091?ContentTypeID=1</link><pubDate>Tue, 27 Mar 2018 11:35:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c37e177f-765b-4f76-a017-25eb4e1097fa</guid><dc:creator>Nikkidutch</dc:creator><description>&lt;p&gt;Hello Ulrich, I also have the same problem and I am waiting on the BLE_GATTC_EVT_WRITE_RSP before calling &amp;quot;sd_ble_gattc_write&amp;quot; again. I still get a BUSY error. What is the problem here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25750?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2015 08:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:656701c0-f54f-4363-8d2a-42d121b52b59</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Sebastian: The suggestion from Ulrich was correct. It&amp;#39;s a write request (write with response), there is no buffer for it so you can only have one write request at a time.
Have you managed to make it work ? If you did could you accept the answer from Ulrich ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25748?ContentTypeID=1</link><pubDate>Fri, 29 May 2015 10:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de3bdd04-21fd-4430-a2b2-8f81eef8004d</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;This really depends on how you have structured your application, but the event will come when the peer has responded, which can (by the spec) take up to 30 seconds. Usually it will take 2 connection intervals.&lt;/p&gt;
&lt;p&gt;If your app is interrupt-driven, an incoming event will trigger an interrupt and call all the on_ble_evt() handlers of each module. Then you have to somehow queue the packets yourself whenever write() returns BUSY, and retry again once the response is cleared. This means you have to continue sending the next write (if any) when WRITE_RSP is received.&lt;/p&gt;
&lt;p&gt;sd_app_evt_wait() puts the CPU into sleep until an event triggers (unless one is already pending), and continues from where it left off. But you do not know which event that woke you up, so you would have to set some state/flag that you can check when you wake up, then sleep if it was the wrong event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25747?ContentTypeID=1</link><pubDate>Fri, 29 May 2015 09:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab45746f-93f7-4632-96cf-dfd93816e153</guid><dc:creator>Sebastian </dc:creator><description>&lt;p&gt;Ok thank i think i get it, but how can i wait on BLE_GATTC_EVT_WRITE_RSP?
Is there a special function for this, maybe sd_app_evt_wait()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25746?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 09:32:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccc6984c-bd61-4468-8cdb-4a608b4f7b0a</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;I think the issue here is that you are trying to send multiple write &lt;strong&gt;requests&lt;/strong&gt;. You cannot send a new request before you have received a response, unlike the write &lt;strong&gt;command&lt;/strong&gt; which has no response. Until the response is received, sd_ble_gattc_write() will return NRF_ERROR_BUSY. You should therefore either:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Wait for BLE_GATTC_EVT_WRITE_RSP before sending a new write request.&lt;/li&gt;
&lt;li&gt;Change to write command, and track free application buffers.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It is important to notice that option 1 will take a bit longer time (1-2 connection intervals per CCCD), compared to write command which can write to up to 6 per connection interval (depending on the peer and the softdevice version). Option 2 can also fail if the number of CCCDs go beyond the number of available application buffers, which means you have to keep track of these separately to run safely. This is done by waiting for BLE_EVT_TX_COMPLETE events and counting how many buffers that were freed. There are multiple threads about this on DevZone if you go for this option.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25749?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 07:07:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bef162e4-dbc3-4ae6-aa54-61961dd041a7</guid><dc:creator>Sebastian </dc:creator><description>&lt;p&gt;First: Thank you for your quick answer.
Second: When i try this with a for loop&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for(uint8_t i = 0; i &amp;lt; p_evt-&amp;gt;params.discovered_db.char_count; i++)
{
     write_params.write_op = BLE_GATT_OP_WRITE_REQ;
  write_params.handle   =   p_client-&amp;gt;srv_db.services[0].charateristics[i].cccd_handle;
  write_params.offset   = 0;
  write_params.len      = sizeof(buf);
  write_params.p_value  = buf;
  err_code = sd_ble_gattc_write(p_client-&amp;gt;srv_db.conn_handle, &amp;amp;write_params);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the Program crashes. I ve read in a different thread that i should use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  sd_app_evt_wait();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but Im not shure how to use this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25751?ContentTypeID=1</link><pubDate>Wed, 27 May 2015 12:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cad7017-2717-447b-b897-3db520f30a59</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Sebastian: Looking at the code seems that you called sd_ble_gattc_write() only once. You would need to call it 4 times, one for each of the characteristic&amp;#39;s CCCD you want to enable (each char_index).&lt;/p&gt;
&lt;p&gt;In the ble_app_multilink_central we only called once because we only have one characteristic that has CCCD to look for.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Multiple Characteristics and Notifications</title><link>https://devzone.nordicsemi.com/thread/25745?ContentTypeID=1</link><pubDate>Wed, 27 May 2015 11:29:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df387481-bd54-4aef-b99f-8ed802a0a013</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Sebastian: you need to add more information on how the software crashed.&lt;/p&gt;
&lt;p&gt;Have you checked the err_code when you call the function to write CCCD (to enable notification) ?&lt;/p&gt;
&lt;p&gt;Have you make sure you selected the correct connection handle (conn_handle) when calling sd_ble_gattc_write() ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>