<?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 command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8764/write-command-and-notification-in-the-same-channel</link><description>Dear Nordic Developers, 
 I&amp;#39;m trying to write some data to a slave and when the slave gets the write command sends back a notification. My problem is that I send the write command in one radio channel (for example channle 35) but I get the notification</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Aug 2015 14:06:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8764/write-command-and-notification-in-the-same-channel" /><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32142?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2015 14:06:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b05054a4-def2-4703-a116-02a93b4df18c</guid><dc:creator>chinargor</dc:creator><description>&lt;p&gt;Thanks for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32138?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2015 14:05:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afdb8da6-6e9d-46d1-b5d3-2ea37b54f389</guid><dc:creator>chinargor</dc:creator><description>&lt;p&gt;Thanks a lot for your help it was really helpful&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32133?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2015 14:05:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ac3720e-8934-49fc-bbf2-7fa2627ee8d9</guid><dc:creator>chinargor</dc:creator><description>&lt;p&gt;Hi Hung Bui&lt;/p&gt;
&lt;p&gt;Thanks for your help. Sorry for not being clear. The idea to use the same or connection event for getting a write command and sending back notification was to make similar to our proprietary radioprotocol, but it&amp;#39;s not a must, I can use next connection event.&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32132?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2015 13:25:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84d1d4ef-a8e5-4ee3-b282-1f4de47314c3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Chinargor: I was misunderstood that 34 - 26 -26 -34 was the RF channel but they actually the length.
So nothing strange from the sniffer.&lt;/p&gt;
&lt;p&gt;Correct me if I am wrong, you want to have the notification at the same connection event when you receive the write command.&lt;/p&gt;
&lt;p&gt;You should use word &amp;quot;connection event&amp;quot; instead of &amp;quot;channel&amp;quot;.&lt;/p&gt;
&lt;p&gt;As discussed by RK and Nathan bellow, it&amp;#39;s not possible to control what should be sent when the connection event occurs. You have to queue the packet in advance. If you transmit large number of data packet, and you make sure you always fill the TX buffer (7 packets max) on the nRF51 you should be able to achieve that all of the slot is used (max 6 packets per connection) to transmit notification data packet.&lt;/p&gt;
&lt;p&gt;Could you give me some more information on the purpose that you want the notification should be on the same connection event with the write command ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32131?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2015 06:50:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c5d44e4-9702-4377-9b00-78b425c9ca36</guid><dc:creator>chinargor</dc:creator><description>&lt;p&gt;Hi Hung Bui&lt;/p&gt;
&lt;p&gt;Thanks a lot for your response. I have uploaded the wireshark trace file. Just for information. I&amp;#39;m using two different characterestic one for write command and the other one for notification. As soon as I get a write command in a handler function I send the notification.&lt;/p&gt;
&lt;p&gt;Thanks again for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32137?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 14:41:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aafe6601-c715-4fbe-a3e8-7ecfc03b99f2</guid><dc:creator>Nathan</dc:creator><description>&lt;p&gt;As for the comment about thinking of it like connection pairs, yes that&amp;#39;s a little misleading when you start talking about multiple packets per connection event, sorry about that. A more accurate thing for me to say would be that each side must speak at least once per connection interval, even it it&amp;#39;s to report that it is just still there listening (empty PDU), and all packets sent during a single connection interval are basically simultaneous. Also, the comments on Jan&amp;#39;s answer are correct regarding why the response from the slave didn&amp;#39;t happen on line 3991. When the softdevice asserts to handle a connection event, the main application you create is completely held off. Therefore you don&amp;#39;t have the ability to process the data that came down until after the event is over, so you can only buffer a response in time for the next connection interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32136?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 14:33:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:572a48bb-58a5-4b67-bca4-415c1a16bec4</guid><dc:creator>Nathan</dc:creator><description>&lt;p&gt;Gor,&lt;/p&gt;
&lt;p&gt;The Nordic softdevice has an internal buffer so that you can buffer multiple packets before the connection event starts, which all get sent out in the least number of connection events automatically. This allows multiple packets to be sent out in a connection interval, but remember that the receiving device will not have time to parse them until at least the next connection event. For notifications, you do this by calling sd_ble_gatts_hvx multiple times and check for the return value. If the return value was success, the packet was buffered successfully. If the return value was BLE_ERROR_NO_TX_BUFFERS or NRF_ERROR_INVALID_STATE or BLE_ERROR_GATTS_SYS_ATTR_MISSING, then the buffer is full, you have to wait until next connection (use BLE_EVT_TX_COMPLETE event to know when). Be careful though, the Apple BLE stack can only handle 4 packets per interval, unlike the Nordic&amp;#39;s 6.&lt;/p&gt;
&lt;p&gt;Nathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32141?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 13:47:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:967a7236-d6e9-46c5-b1eb-feefa8c07ecf</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;True, my third bullet is then rather theoretical or applicable on other HW/stack implementations. Still it would work for &amp;quot;independent&amp;quot; streams of data transported over Write and Notify commands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32140?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 13:27:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f19e7ebc-9995-474d-8192-92bfd3b96508</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I don&amp;#39;t believe Nordic&amp;#39;s stack lets you do this at all, however fast you may be. As far as I have ever understood it, only data queued up and ready to go before the connection event begins is prepared and transmitted during that connection event. If you add anything new during the connection event, it waits for the next one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32130?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 12:54:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c43a88ff-ede2-4b4a-b9b8-954d096dca24</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Gor,&lt;/p&gt;
&lt;p&gt;This is strange. Could you upload the sniffer trace file ?  In addition a screenshot would be nice. You can edit your question to add the files in.
The slave shouldn&amp;#39;t response to the master on different channel than the channel the last packet from master comes to slave.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32139?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 10:53:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f351233a-ad64-484c-9568-d504c5b762c8</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;I believe Nathan gave the answer pretty nicely:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;BLE spec allows you to do Write and Notify over the same GATT handle (Characteristic) within the same Connection event (one or several pairs of packets exchanged over the same frequency channel).&lt;/li&gt;
&lt;li&gt;Nordic&amp;#39;s stacks allows you to use this BLE feature as well...&lt;/li&gt;
&lt;li&gt;...but your app must keep timing of the BLE connection which is very strict (there are only 150us between Tx and Rx windows) so I doubt you would be able to receive something from central side, process it and prepare Event Notification Tx data to the SoftDevice within that short window to send it out within same Connection Event.&lt;/li&gt;
&lt;li&gt;However if you have two independent data streams it should be possible to run them in parallel from both sides and effectively &amp;quot;share&amp;quot; Connection Evenets.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cheers Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32135?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 06:09:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18ef7e65-237c-4aaa-9bdd-de8d94e46539</guid><dc:creator>chinargor</dc:creator><description>&lt;p&gt;Hi Nathan&lt;/p&gt;
&lt;p&gt;Thanks a lot for your answer and help. I&amp;#39;m sorry for not beeing clear. Yes I meant 2.4GHz radio channel. The idea to use the same radio channel (or connection event) for getting a write command and sending back notification was to make similar to our proprietary protocol, but it&amp;#39;s not a must. Now I really don&amp;#39;t understand how can I send more than one packets in one connection event? (As all packets in a connection event are transmitted on the same frequency). Do you have any idea?&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write command and Notification in the same channel</title><link>https://devzone.nordicsemi.com/thread/32134?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2015 17:03:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c686fbe-ea71-4e5b-8a5a-f016b0efdf69</guid><dc:creator>Nathan</dc:creator><description>&lt;p&gt;Gor,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m actually a bit confused by this question. When you say channel did you mean characteristic? If that&amp;#39;s the case then yes, you should be able to issue write commands from the gatt client and issue notifications from the gatts server over the same BLE characteristic, which is parsed out in code easily enough.&lt;/p&gt;
&lt;p&gt;If you meant literal 2.4GHz radio channel, then no, that&amp;#39;s not possible. BLE by design uses an adaptive frequency hopping algorithm to help prevent radio collisions with other devices. This behavior cannot be shut down nor suppressed.&lt;/p&gt;
&lt;p&gt;If the question was targeted to the second case, is there any reason why you would want to use the same 2.4GHz channel continuously? There&amp;#39;s pretty much no benefit to that as far as I can see.&lt;/p&gt;
&lt;p&gt;Finally, you asked if there&amp;#39;s a way to increase the time between lines 3990 and 3991. In this case the answer is no, BLE is a communication scheme where both sides talk to each other at every &amp;quot;connection interval&amp;quot;. Those two events listed happened during the same connection event, which means they occurred basically simultaneously (it&amp;#39;s used to detect link loss and make sure both sides get to communicate instead of just one side constantly blocking the connection). Think of it like a full duplex connection, if that helps. You can however modify the link&amp;#39;s connection interval so that each of these communication &amp;quot;pairs&amp;quot; happen at shorter or longer time periods.&lt;/p&gt;
&lt;p&gt;Nathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>