<?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>S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21306/s132-is-it-possible-to-send-an-empty-notification</link><description>My previous product uses an empty notification to indicate that a bulk transfer is finished. I attempted to send an empty notification but got error code 0x10 (NRF_ERROR_INVALID_FLAGS). 
 Is there a way to send an empty notification? 
 ble_gatts_hvx_params_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Apr 2017 19:46:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21306/s132-is-it-possible-to-send-an-empty-notification" /><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83478?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 19:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a561a0a-078d-44f9-bbd4-25e9946d53d7</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;So it would appear that when I try to send an empty notification, it instead sends whatever is currently contained in the characteristic. So when I send only empty notifications, I receive 9 bytes of 0xFF  because thats what I wrote to the start the transfer.&lt;/p&gt;
&lt;p&gt;When I send the count pattern, the last notification is the count that would have been sent next.  So it appears that sd_ble_gatts_hvx() updates the characteristcs value even though a  BLE_ERROR_NO_TX_PACKETS is returned.&lt;/p&gt;
&lt;p&gt;This leads me to the following code which does send empty notifications.  Thanks to @endnote for all the help.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t err_code = NRF_SUCCESS;
uint16_t               hvx_len = 0;
ble_gatts_hvx_params_t hvx_param_empty =
{
    .type   = BLE_GATT_HVX_NOTIFICATION,
    .handle = p_ctx-&amp;gt;bulkdata_handle,
    .p_data = NULL,
    .p_len  = &amp;amp;hvx_len,
};

 // Set characteristic value to len zero so we can send an empty notification
 ble_gatts_value_t gatts_value;
 memset(&amp;amp;gatts_value, 0, sizeof(gatts_value));
 gatts_value.len = 0;
 err_code = sd_ble_gatts_value_set(p_ctx-&amp;gt;conn_handle, p_ctx-&amp;gt;bulkdata_handle, &amp;amp;gatts_value);
 APP_ERROR_CHECK(err_code);

 err_code = sd_ble_gatts_hvx(p_ctx-&amp;gt;conn_handle, &amp;amp;hvx_param_empty);
 if (err_code != NRF_SUCCESS)
 {
     NRF_LOG_ERROR(&amp;quot;sd_ble_gatts_hvx() failed: 0x%x\r\n&amp;quot;, err_code);
 }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83462?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 19:02:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:075c7788-d7d9-4093-82a3-c5edbc6d7803</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Well let&amp;#39;s try to follow for little while. Can you show me more of that trace where you send 10kB in &amp;quot;full&amp;quot; ATT Notify packets and then there is one more &amp;quot;empty/non-empty&amp;quot; packet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83461?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 18:55:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83a0cb79-624b-4175-a962-6d85c25a817a</guid><dc:creator>jcormier</dc:creator><description>&lt;ol&gt;
&lt;li&gt;So yes thanks for pointing this out, I was able to confirm that when I send the empty notification I do receive one extra notification packet.  However it is not empty.&lt;/li&gt;
&lt;li&gt;Yes I caught that when you posted your recent answer.  Fixing this didn&amp;#39;t seem to change anything though.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83460?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 18:35:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba863a9c-dd1a-4cfa-85af-40bcfa023792</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Two comments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You have now one more tx_complete so I assume it went through. Are you sure you don&amp;#39;t overlook it in RF sniffer trace?&lt;/li&gt;
&lt;li&gt;Your code sample have a bug from my point of view. &lt;code&gt;hvx_param.p_len = 0;&lt;/code&gt; should be changed to something like &lt;code&gt;uint16_t hvx_len = 0; hvx_params.p_len = &amp;amp;hvx_len;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83463?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 16:21:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:861b6da7-59eb-46d2-897e-d0617ad596ed</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Soooo, too many TI in one thread made me angry so I&amp;#39;ve tried &amp;quot;empty&amp;quot; Notification on nRF52 with S132 V2.0.1 (using GAP Peripheral and GATT Server roles). It works like a charm, I can see empty HVX packet (only 3 bytes in ATT layer: HVX op code 0x1B and 16-bit ATT handle id) on my sniffer. Here is code sample which made the job for me (called right after GAP Central/GATT Client enabled notifications on my Characteristic):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint16_t               hvx_len = 0;
ble_gatts_hvx_params_t hvx_params;
memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

hvx_params.handle   = m_message_handles.value_handle;
hvx_params.type     = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset   = 0;
hvx_params.p_len    = &amp;amp;hvx_len;
hvx_params.p_data   = NULL;

sd_ble_gatts_hvx(m_conn_handle, &amp;amp;hvx_params);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83477?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 15:41:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73721211-5a8c-4466-ab8f-c80d1c1f0ebc</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;Well I might try to get the nordic sniffer working. Atleast wireshark probably won&amp;#39;t crash every few minutes.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m in a small company working on a project for a large company.  So 4k maybe a hard sell.  But I can always ask :P&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83476?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 15:36:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1edea610-8b35-4f5c-a6ad-e68aebf74cb2</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;For me TI dev kit with sniffer FW is only little worse then nRF51 DK (~$40) with Nordic sniffer FW (it uses Wireshark unlike TI which uses this proprietary colorful GUI), in the end they are both same price so roughly same performance. Frontline BPA Low Energy is much better (kind of industry standard) but it costs typically ~$4000, if you get lucky you can get it as low as $1000 in some markets and distributers. Then you can have also support and maintenance license extension beyond 1st year, typically costs 1-2k USD per 3 years. But that only gives you SW and FW upgrades, you can save some money, not pay for maintenance and live on older SW version. I do recommend it, fo any mid/large company 4k USD is nothing when it comes to R&amp;amp;D tools.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83475?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 15:19:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f1ea471-34d2-433c-a13a-2f4e8ef279d2</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;I can&amp;#39;t say I&amp;#39;m happy with the TI sniffer but it was all I had in the past and I haven&amp;#39;t tried the nordic sniffer as I currently only have one noridic devkit.&lt;/p&gt;
&lt;p&gt;PS: I&amp;#39;d love to get a dedicated sniffer if they aren&amp;#39;t too expensive, if you have a recommendation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83474?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 15:09:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcf69684-3696-4103-be6e-7c28dca546e6</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;It was &amp;quot;empty &lt;code&gt;sd_ble_gatts_hvx&lt;/code&gt;&amp;quot; aka &lt;code&gt;sd_ble_gatts_hvx&lt;/code&gt; with parameters containing &lt;code&gt;p_data = NULL&lt;/code&gt; and &lt;code&gt;p_len = 0&lt;/code&gt;. If you get NRF_SUCCESS then it means that stack accepted the packet and it should be sent out as soon as possible (typically on very next interval). After that really happens you get &lt;code&gt;BLE_EVT_TX_COMPLETE&lt;/code&gt; event call which would indicate it went out over radio. I guess you have better experience with TI sniffer then I do (I&amp;#39;ve used it 3 years ago but Nordic was more reliable for me and then I even switched to Frontline which is several levels better - unfortunately also 100x more expensive) but are you sure you capture whole sequence where should empty ATT Notify packet appear?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83473?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e1cd5b-64c1-4a75-a2a4-428f2fb5938e</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;So far I&amp;#39;ve copied the mtu throughput amts.c example and modified it slightly to send packets when a certain characteristic is written to.&lt;/p&gt;
&lt;p&gt;I was also surprised it was only sending one notification per connection event.  I was expecting atleast 4, that was likely going to be my next problem to look at.  The amts.c code has a while NRF_SUCCESS loop which keeps calling hvx() until it gets the NO_TX_PACKETS error so I&amp;#39;d have expected it to send more than just one per.&lt;/p&gt;
&lt;p&gt;Note that is just the bottom of the log, it sends about 10k of packets total for this test.&lt;/p&gt;
&lt;p&gt;&amp;quot;Do you get this also when you send to the stack through SD API empty sd_ble_gatts_hvx?&amp;quot; Whats SD API empty?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83472?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:50:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0c131fc-68d0-46b2-97f5-5bc2d907c6d1</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Yes, I see it now. So the code sends 3 &amp;quot;full&amp;quot; packets and then empty one? I&amp;#39;m surprised that if you do so that there are no connection interval with several PDUs/MTUs exchanged. Or do you send it one by one after you receive &lt;code&gt;BLE_EVT_TX_COMPLETE&lt;/code&gt; (or some equivalent)? Do you get this also when you send to the stack through SD API empty &lt;code&gt;sd_ble_gatts_hvx&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83471?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:825b644b-8ba6-49f5-9b8c-c9e9b68e1ae3</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;Thanks. Yes I added the picture to the original post.  After the count pattern is finished sending there is supposed to be an empty notification packet sent.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83470?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:45:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a07f79c8-033b-4776-a8d5-5903aad4f5d9</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;No, sniffer is the right thing, I don&amp;#39;t have any other magic tool. Notify is ATTribute layer method (command if you want), that&amp;#39;s why I talk about ATT MTU. You can only update your original question or create answer, you cannot add images to the comment on this forum. So what you say is that by using code snippet pasted above you are able to issue &lt;code&gt;sd_ble_gatts_hvx(...)&lt;/code&gt; with &lt;code&gt;NULL&lt;/code&gt; pointer in &lt;code&gt;p_data&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; in &lt;code&gt;p_len&lt;/code&gt;, you get &lt;code&gt;NRF_SUCCESS&lt;/code&gt; as error code but you cannot see any Notification issued over BLE link, there are just empty LL PDUs exchanged every connection interval?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83469?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:40:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98a688cc-78da-4182-bd87-06c2e0c001f1</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;endnode, I&amp;#39;m not sure what you mean by ATT MTU but I am not receiving an empty notify packet on my client side.&lt;/p&gt;
&lt;p&gt;Since you suggested it, I fired up the ble sniffer and confirmed that I am not seeing the packet sent here either. I can see the last 20B notification which I received but no empty notification send. Note: I can&amp;#39;t see to attach an image to a comment.&lt;/p&gt;
&lt;p&gt;Not sure what you mean by watching &amp;quot;in radio&amp;quot;.  Is there some way to get more detailed info from the S132 about what its doing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83468?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 14:00:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17ecda70-733e-44e1-9433-4a69a0338f85</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;So it means you are sure there is no ATT MTU sent over LL PDU supported by BLE sniffer? i know that empty Write is definitely triggering GATT Server events on nRF5x with S110 and S13x, I do expect the same for other ATT methods like Notify. On GATT Client side it&amp;#39;s a question if empty ATT MTU with given OPcode and handle number will go out, unfortunately I cannot test it now. But if you are testing this scenario please make sure you are watching what happens in radio not somewhere in mobile API or controller.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83467?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 13:06:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d33cd26-017b-44dc-9963-f645c54918b1</guid><dc:creator>jcormier</dc:creator><description>&lt;p&gt;Endnote and Aryan, Thanks for the response.  Setting the data pointer to null avoids the error but no notification packet was received on the other side.    I&amp;#39;m using SDK 12.2.0.&lt;/p&gt;
&lt;p&gt;This is something that works with the TI BLE sdk. I would like to keep the old and new products API as consistent as possible, so any help would be appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83465?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 10:17:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d8c513c-cbf9-48bc-91e3-2b79d6499eab</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Looking at the code it looks like they can send a empty notification if the data pointer is NULL with length field set to 0. Can you please give it a try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83466?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 09:35:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7a37f41-8307-4e2a-9155-b65cfb503986</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Isn&amp;#39;t this unfortunate limitation because other systems can do that (at least they can do this for ATT Write methods)? Or can Nordic Soft Devices send empty Notification if data pointer is &lt;code&gt;NULL&lt;/code&gt;? And does this apply also to Write methods or these behave differently?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S132: Is it possible to send an empty notification</title><link>https://devzone.nordicsemi.com/thread/83464?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 08:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2af04cbe-bb07-4b0e-8fba-51d7453b07a2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;No, you cannot have p_len == 0 when p_data != NULL.
you will get &lt;code&gt;NRF_ERROR_INVALID_ADDR&lt;/code&gt; = 0x10 error when hvx_param.p_len = 0;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>