<?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>Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43576/queries-on-nus_data_send-functionality</link><description>Hi, I have a few general questions on nus_data_send(). 
 
 First off, is there another known way of transferring an array/string via ble to the Nordic mobile app other than the NUS service? 
 Secondly, does the nus_data_send() function always need an</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Feb 2019 09:23:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43576/queries-on-nus_data_send-functionality" /><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/173179?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 09:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6375568-4539-44a7-8e50-1a5d09686e02</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Everything sending over BLE (or any protocol) is converted to byte array. If you send ASCII data, on the other side it will be converted to string inside the UART app.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/172874?ContentTypeID=1</link><pubDate>Mon, 25 Feb 2019 19:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce784efc-0025-4b2f-b766-5f4faa9037a0</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;The ble_nus_string_send() is a function for sending string data, like data_send() but different in that it&amp;#39;s for string values. Since my data is hex I wanted to send it as a string.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/172706?ContentTypeID=1</link><pubDate>Mon, 25 Feb 2019 09:28:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe70302f-a45a-4b34-9da6-683ba4d7feb3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Which&amp;nbsp;&lt;span&gt;ble_nus_string_send() are you talking about ? Do you mean&amp;nbsp;ble_nus_data_send() ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am not sure what exactly you want to do . If you want to display the hex value of your data you can follow what we do in the app (the logging &amp;quot;Notification received from... &amp;quot; ) .&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/172579?ContentTypeID=1</link><pubDate>Fri, 22 Feb 2019 22:02:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7df8c82b-8050-418d-b594-56f5ac22829e</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;I understand that my value is a HEX/int which is why the ASCII characters on screen do not make sense.&amp;nbsp;&lt;br /&gt;Is the value shown after&amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;quot;Notification received from...&amp;quot; the original array value? The 0x-FF-FF-FF-FF....? If so I think that may be the right kind of data I&amp;#39;m expecting.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I still have two questions though? How do I convert my int or hex array to ASCII? Do I have to convert to ASCII or should the&amp;nbsp;&amp;nbsp;&amp;quot;Notification received from...&amp;quot; part show me my data as it is anyway?&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1550872990043v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried using defining a char array and sending that array with my HEX data through the ble_nus_string_send() but that gives me an error as well. The program says I am calling&amp;nbsp;ble_nus_string_send() implicitly and that it is an UNDEFINED call. I made sure I am including &amp;quot;string.h&amp;quot; and &amp;quot;stdlib.h&amp;quot;.... How can I use the string_send() function accurately?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/172254?ContentTypeID=1</link><pubDate>Thu, 21 Feb 2019 09:24:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3d21499-3cfb-4b66-8bff-dbab27a89701</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What do you mean by &amp;quot;the data on the app does not make sense&amp;quot; ?&lt;/p&gt;
&lt;p&gt;Have you checked the hex value you see in &amp;quot;Notification received from...&amp;quot; if it&amp;#39;s is correct ? The weird characters you&amp;nbsp;&amp;nbsp;see in the screenshot was simply because it&amp;#39;s expected to printout ASCII character (Unicode actually) and the value you are sending to the app is clearly not ASCII characters.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/171701?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 15:53:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac435013-801d-4d48-9569-56f5ce7d37e8</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;No I am not doing all three calls at the same time.&amp;nbsp;I call the nus_data_send() only once in the entire project.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I tried doing these single calls at three different places in the code... I am calling the function once in each case, but I do not get tangible data in any scenario.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/171495?ContentTypeID=1</link><pubDate>Sat, 16 Feb 2019 02:10:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6a5839d-cda6-46f1-a4cd-5628af6a4d08</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Not sure if this helps, but it&amp;#39;s easy to forget that the application is effectively multi-threaded.&amp;nbsp;&lt;em&gt;ble_nus_data_send()&lt;/em&gt; is by default invoked within an event, which is effectively an interrupt to the &lt;em&gt;main()&lt;/em&gt;. One might think that sprinkling a few other&amp;nbsp;&lt;em&gt;ble_nus_data_send()&lt;/em&gt; calls in (say) &lt;em&gt;main()&lt;/em&gt; would not be an issue, but in that case one invocation may be interrupted by another, following which the send buffer&amp;nbsp;data_array becomes corrupted as two messages stomp on each other. Since the serial port i/o and the BLE serial packets are all events, this can get interesting; throw in yet another call from the SPI interrupt and without adding a lock or semaphore or other signal at some point data corruption will occur.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/171492?ContentTypeID=1</link><pubDate>Sat, 16 Feb 2019 00:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dffd130-dddc-45d2-8662-5323f5c88778</guid><dc:creator>noob_with_ucontrollers</dc:creator><description>&lt;p&gt;Thank you &lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have tried calling nus_data_send() function from:&lt;/p&gt;
&lt;p&gt;1. within the NUS_DATA_HANDLER,&lt;/p&gt;
&lt;p&gt;2. The main program after advertising_start()&lt;/p&gt;
&lt;p&gt;3. The SPI event handler (I am using SPI communication to get data from my ADC chip ADS1220 so I call the nus_data_send of spi data from the spi_evt_handler). So I tried calling the data transfer from the SPI/NUS &amp;quot;interrupts&amp;quot; and the main() but it seems it&amp;#39;s not being called properly.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The data it sends me on my Android phone NRF_TOOLBOX app does not make sense. I am sure the SPI within the ble-uart project is working correctly (I analyzed pins) but I don&amp;#39;t get why the nus_data_send won&amp;#39;t throw the spi values to the app..&amp;nbsp;&lt;br /&gt;I am using nrf52382, IDE is embedded studio, SDK 15.2, and I am programming a custom made PCB device using NRF52 DK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is how my app receiving data from the board via BLE and my function call looks like...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1550276763356v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;  err_code1 = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);
                        if ((err_code1 != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
                            (err_code1 != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
                            (err_code1 != NRF_ERROR_NOT_FOUND))
                        {
                            APP_ERROR_CHECK(err_code1);
                        }


// data_array is initialized with RX data buffer from SPI &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Queries on nus_data_send() functionality?</title><link>https://devzone.nordicsemi.com/thread/170642?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 13:37:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5825acaf-2eb0-4432-a5a0-c7b787df810c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As the name BLE suggested, it&amp;#39;s for low power application. You can of course choose not to put the CPU to sleep. If you don&amp;#39;t want to do processing inside an interrupt you can use &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/group__app__scheduler"&gt;app scheduler&lt;/a&gt; to put your code into main context.&amp;nbsp;&lt;br /&gt;If you don&amp;#39;t need to wait for an interrupt, you can call any function from main, no problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>