<?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>How to use &amp;quot;ble_nus_string_send correctly&amp;quot; ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30545/how-to-use-ble_nus_string_send-correctly</link><description>Hello everybody, I try to send nus_string data. I bought different inputs and outputs like this; 
 INPUT; 
 
 
 
 OUTPUT; 
 &amp;quot;aaaaa&amp;quot; received // Send 5 times &amp;quot;a&amp;quot; 
 
 INPUT; 
 
 
 OUTPUT; 
 There is no response! 
 
 1-Why do I see 5 characters when I enter</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Feb 2018 15:15:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30545/how-to-use-ble_nus_string_send-correctly" /><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121815?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 15:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb4954e3-d67a-437d-8225-4c160f672450</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Look more closely at the responses; you need this:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;uint16_t length = sizeof(string);&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121762?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 08:48:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b6b5d34-637d-422f-87fe-63b08b14b39c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Did you notice &amp;amp;length?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121753?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 06:35:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5337bae-40d5-45f3-b089-5e1d53242d84</guid><dc:creator>purgoufr</dc:creator><description>&lt;p&gt;I got an error like this ;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;..\..\..\main.c(853): error:&amp;nbsp; #167: argument of type &amp;quot;uint16_t *&amp;quot; is incompatible with parameter of type &amp;quot;uint16_t&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I try to define&amp;nbsp;uint16_t* length = sizeof(string);&lt;/p&gt;
&lt;p&gt;But that did not work either.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121748?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 05:00:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f316e16d-3ca0-4e9c-bee0-9671e3ac25ca</guid><dc:creator>purgoufr</dc:creator><description>&lt;p&gt;I got an error like this ;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;..\..\..\main.c(853): error:&amp;nbsp; #167: argument of type &amp;quot;uint16_t *&amp;quot; is incompatible with parameter of type &amp;quot;uint16_t&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I try to define&amp;nbsp;uint16_t* length = sizeof(string);&lt;/p&gt;
&lt;p&gt;But that did not work either.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121742?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 21:47:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e396347-4420-47a6-99c5-d1e8d5d5e718</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;In addition to the other points,&amp;nbsp;(uint16_t *)17 doesn&amp;#39;t do what you think. It actually indicates the contents of physical memory address 17. Not surprisingly the byte contents of physical address 17 is likely 5. So instead use a variable thus:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint16_t someLength = 17;
blahBlah, &amp;amp;somelength, BlahBlah
or better
uint16_t someLength = sizeof(whatever);
blahBlah, &amp;amp;somelength, BlahBlah
or better for strings
nt16_t someLength = strlen(&amp;quot;whatever dude&amp;quot;);
blahBlah, &amp;amp;somelength, BlahBlah
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121729?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 17:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:251957c6-56a8-47d3-b1f1-f9aae07d4578</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;APP_TIMER_DEF(send_some_uart_data);    /**&amp;lt; Some timer */

void send_some_uart_data_handler(void * p_context)
{
    ret_code_t err_code;
    
    uint8_t string[] = &amp;quot;serial updated\n\r&amp;quot;;
    uint16_t length = sizeof(string);
    
    do
    {
        
        err_code = ble_nus_string_send(&amp;amp;m_nus, string, &amp;amp;length);
        if ( (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (err_code != NRF_ERROR_BUSY) )
        {
            APP_ERROR_CHECK(err_code);
        }
    } while (err_code == NRF_ERROR_BUSY);    
}

void send_some_data_uart_init(void)
{
    app_timer_create(&amp;amp;send_some_uart_data,APP_TIMER_MODE_REPEATED, send_some_uart_data_handler);
    app_timer_start(send_some_uart_data, APP_TIMER_TICKS(1000), NULL);
}

// Call send_some_data_uart_init(); in main() to run send_some_uart_data_handler() at configured internal.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121624?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 09:00:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c0eebc4-2872-4251-9ea4-a275c69e7690</guid><dc:creator>purgoufr</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;o&amp;gt; NRF_SDH_BLE_GAP_EVENT_LENGTH - The time set aside for this connection on every connection interval in 1.25 ms units. 
#ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
#define NRF_SDH_BLE_GAP_EVENT_LENGTH 3
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could it be an effect of this setting?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121496?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 10:14:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03e1ff71-9dd9-4e18-832e-4285003a6045</guid><dc:creator>purgoufr</dc:creator><description>&lt;p&gt;Original code like this;&lt;/p&gt;
&lt;p&gt;while(ble_nus_string_send(&amp;amp;m_nus, (uint8_t *)&amp;quot;serial no updated&amp;quot;, (uint16_t *)17) != NRF_SUCCESS);&lt;/p&gt;
&lt;p&gt;and I received &amp;quot;seria&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121476?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 08:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e876d58-3472-49c1-bd1f-952065cee9e0</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Blank character should not be a problem, I am more concerned about the 2 non-defined characters that I can&amp;#39;t see from the string.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121462?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 06:19:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26c5f65a-3546-4584-9575-350fcd41aa08</guid><dc:creator>purgoufr</dc:creator><description>&lt;p&gt;Normally I did not use &amp;quot;a&amp;quot; character just I write sample string.&amp;nbsp;I&amp;#39;ve just realized, spacing between characters can be messing up. Can not perceive blank as character?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use "ble_nus_string_send correctly" ?</title><link>https://devzone.nordicsemi.com/thread/121260?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 13:25:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f84fe33f-7945-43b5-aac8-54514450b55f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;For debugging I suggest to make the length parameter be the size of the string, the length of the two strings above seems to be 15 and 17, not 17 and 19?&lt;/p&gt;
&lt;p&gt;Can you use &amp;quot;abcde..&amp;quot; instead so we may see if it&amp;#39;s the first or last bytes that is missing?&lt;/p&gt;
&lt;p&gt;Have you checked the baudrate is correct and possible tried to disable hardware flow control?&lt;/p&gt;
&lt;p&gt;I assume there is no assert occuring here on either sides of the link?&lt;/p&gt;
&lt;p&gt;Finally, for testing you may also remove&amp;nbsp;power_manage() to see if that make any difference.&lt;/p&gt;
&lt;p&gt;Hopefully one of these changes will change behaviour and identify the cause.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>