<?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>sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7165/sd_ble_gatts_hvx-always-send-data-from-0x00-address</link><description>Hello,
I have a problem with Indicate Characteristic. When I try to send data using sd_ble_gatts_hvx() function, it always sends 20bytes from address 0x00. This is my code for sending data: 
 uint16_t hvx_len;
 ble_gatts_hvx_params_t hvx_params;
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 May 2015 12:11:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7165/sd_ble_gatts_hvx-always-send-data-from-0x00-address" /><item><title>RE: sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/thread/25326?ContentTypeID=1</link><pubDate>Thu, 21 May 2015 12:11:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bd8c4c0-c31e-48e9-b45b-7dff4ca5d1be</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Thank you for answering your own question!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/thread/25325?ContentTypeID=1</link><pubDate>Thu, 21 May 2015 11:26:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:792d50c3-3829-4429-ad2b-6e614b2b5494</guid><dc:creator>Jakub</dc:creator><description>&lt;p&gt;I found a solution. Reason was that I chose to store characteristic value in application memory (VLOC_USER). Therefore characteristic should be given a buffer to data.
In characteristic initialization:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;attr_char_value.p_uuid       = &amp;amp;ble_uuid;
attr_char_value.p_attr_md    = &amp;amp;attr_md; 
attr_char_value.init_len     = 20;
attr_char_value.init_offs    = 0;
attr_char_value.max_len      = 0; 
attr_char_value.p_value      = buffer;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In function which sends data:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    hvx_params.handle = p_dt-&amp;gt;tx_handles.value_handle;
    hvx_params.type   = BLE_GATT_HVX_INDICATION;
    hvx_params.offset = 0;
    hvx_params.p_len  = &amp;amp;hvx_len;
    hvx_params.p_data = NULL;   //it means that SD will use pointer given in init
    
    err_code = sd_ble_gatts_hvx(p_dt-&amp;gt;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: sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/thread/25324?ContentTypeID=1</link><pubDate>Wed, 20 May 2015 19:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:beceef07-4a91-4c33-aa1f-7a13016e8837</guid><dc:creator>muhkuhns</dc:creator><description>&lt;p&gt;What a pity. Because I had the same problem with the hvx command only sending 0x00 bytes and for me it was caused by this little setting I just overlooked in the hectic.&lt;/p&gt;
&lt;p&gt;Could you post the variable you store your data in, please?&lt;/p&gt;
&lt;p&gt;I use this (but for notification) and it works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t value[8] = {0};
hvx_params.p_data = (uint8_t*)&amp;amp;value;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I just read about indications now and it looks like this part differs to notifications as they don&amp;#39;t queue data.. sry..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/thread/25323?ContentTypeID=1</link><pubDate>Wed, 20 May 2015 19:34:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d31dad6c-d840-45a6-a900-a19dee60c55e</guid><dc:creator>Jakub</dc:creator><description>&lt;p&gt;I was trying different settings to get things work or just understand what is happening. Normally it was set to 20, and it didn&amp;#39;t change anything.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx() always send data from 0x00 address</title><link>https://devzone.nordicsemi.com/thread/25322?ContentTypeID=1</link><pubDate>Wed, 20 May 2015 19:32:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ac86580-bb0b-465f-8184-243f567e232e</guid><dc:creator>muhkuhns</dc:creator><description>&lt;p&gt;Why did you set &lt;code&gt;attr_char_value.max_len = 0;&lt;/code&gt; and not 20?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>