<?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>BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85900/ble-notification-sending-invalid-data</link><description>I&amp;#39;m trying to implement a Write / Notify type of GATT Characteristic to return 1 item out of an array of items. 
 So the Central sends an index, and the peripheral sends back a notification with the data at that index 
 the index is 1 byte, the data is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Mar 2022 06:52:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85900/ble-notification-sending-invalid-data" /><item><title>RE: BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/thread/360156?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2022 06:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77f4b277-27d8-4d0e-a4ca-02a5af497245</guid><dc:creator>Edvin</dc:creator><description>[quote user="Keith V"]&lt;p&gt;my custom functions are listed in the message.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Yes, but not all functions that you have used to replicate the issue. Particularly the initialization of the service. Besides. I can set up a characteristic that sends this sort of data (or I can demonstrate it using the ble_app_uart example), but that will not replicate the issue that you are seeing.&lt;/p&gt;
[quote user="Keith V"]I did use a phone, what difference would a dev kit make?[/quote]
&lt;p&gt;No difference. A phone should be fine.&lt;/p&gt;
[quote user="Keith V"]is there an example showing how to do this?[/quote]
&lt;p&gt;How to do what, exactly? The ble_app_uart example is quite versatile, as you can use it to send a data array over BLE.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you upload your project, so that I can simply compile it and run it to replicate the issue, I can have a look at what the issue might be. I can&amp;#39;t tell from the snippets you have provided. But perhaps debugging can give a better idea.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/thread/360051?ContentTypeID=1</link><pubDate>Fri, 25 Mar 2022 14:24:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e83cdc88-a3ba-4f34-8f0d-05f284c5cdb2</guid><dc:creator>Keith V</dc:creator><description>&lt;p&gt;my custom functions are listed in the message.&lt;/p&gt;
&lt;p&gt;LED_TIME_LENGTH is 5 yes&lt;/p&gt;
&lt;p&gt;I did use a phone, what difference would a dev kit make?&lt;/p&gt;
&lt;p&gt;is there an example showing how to do this?&lt;/p&gt;
&lt;p&gt;it can&amp;#39;t be a new idea&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/thread/360019?ContentTypeID=1</link><pubDate>Fri, 25 Mar 2022 13:31:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd7dd686-9e13-430e-84ba-87e2707875b9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what your custom functions do. All I can see is that you are sending LED_TIME_LENGTH bytes (I guess LED_TIME_LENGTH is 5, since you are receiving 5 bytes), and the first byte is the parameter &amp;quot;Type&amp;quot; = data =&amp;nbsp;p_evt_write-&amp;gt;data[0];&lt;/p&gt;
&lt;p&gt;However, it looks like it should be correct from where you print using NRF_LOG_RAW_INFO().&lt;/p&gt;
&lt;p&gt;Is it possible for me to reproduce this on a DK and a phone? If so, would it be possible to share the project?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/thread/359885?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2022 18:51:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfb187b3-cd90-4dbd-b782-5250b0f36eb8</guid><dc:creator>Keith V</dc:creator><description>&lt;p&gt;Thanks Edvin,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My device is the peripheral and nRFConnect ( desktop ) is the central&lt;/p&gt;
&lt;p&gt;I print in 2 places, the on_write() and&amp;nbsp; SendNotify(), the commas are not printed no, here&amp;#39;s whats actually printed: I&amp;#39;ve changed the value 01f4 to 03E8&amp;nbsp; for other reasons....&lt;/p&gt;
&lt;p&gt;nRFConnect should show &amp;quot;(0x) 01-07-D0-03-e8&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; MTserv: BLE_GATTS_EVT_WRITE: 60&amp;lt;
&amp;lt;info&amp;gt; MTserv: LED Time, 1, 03E8, 07D0
Notify, 0, 0107D003E8&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the data buffer looks correct ( same data as notify )&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using nRF connect on the PC, but tried it on my phone with the same results(0x) 00-04-00-20-81&lt;/p&gt;
&lt;p&gt;This is from the PC&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1648147526078v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE notification sending invalid data</title><link>https://devzone.nordicsemi.com/thread/358938?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 22:32:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebe14678-6209-4393-af91-5fa200220f9b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So you are sending this data from a peripheral and receiving it on a central, the central is a computer or a phone?&lt;/p&gt;
&lt;p&gt;Can you please try to debug, and compare the data buffers (length and actual data) when you send it and when it is received?&amp;nbsp;&amp;nbsp;I see that you are printing:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   NRF_LOG_RAW_INFO(&amp;quot;Notify, %d, &amp;quot;, err_code);
   for(int i=0; i&amp;lt; len; i++)
   {
      NRF_LOG_RAW_INFO(&amp;quot;%02x&amp;quot;, data[i]); 
   }
   NRF_LOG_RAW_INFO(&amp;quot;\n&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But you say that you see:&lt;/p&gt;
&lt;p&gt;&amp;quot;02, 01F4, 07D0 ( as output by NRF_LOG_INFO() )&amp;quot;&lt;/p&gt;
&lt;p&gt;Is that what the Notify print is printing? If so, shouldn&amp;#39;t it just output hexadecimal values, and not the commas?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It is not clear to me where you see the. Is the 02, 01F4, 07D0 actually from the NRF_LOG_INFO()?&lt;/p&gt;
&lt;p&gt;And when you say nRF Connect, is it the desktop app, or on a phone?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>