<?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>When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70963/when-ble_nus_data_send-does-not-work</link><description>As below, BLE Data RX works fine, but TX doesn&amp;#39;t. When does this happen? 
 Currently BLE connect/disconnect and RX is working fine. The power does not turn off due to this phenomenon. 
 
 Not all products exhibit the above symptoms. This was the first</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Jan 2021 01:48:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70963/when-ble_nus_data_send-does-not-work" /><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291399?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 01:48:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:093d7afa-9b27-4da5-9cfe-acdfe3288f30</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;I think that it&amp;#39;s must be some bug in your case with non-ascii code(utf.c problems). If your application code in your mobile side(android or ios) is not fixed. You may change the format to ascii code. It&amp;#39;s more safe way for your solution. By the way,...It&amp;#39;s the nRF Toolbox (android &amp;amp; ios) available. You may use this tool for debug( especial the NUS service, define hot key or so on).&lt;/p&gt;
&lt;p&gt;Finally, if you don&amp;#39;t want to change your code to string format, you have to make sure&amp;nbsp;&lt;span&gt;ble_nus_data_send ()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;length&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; uint16_t length = (uint16_t)index;&lt;br /&gt; err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291397?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 01:38:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d48ea9cd-1ff5-46f5-a5f1-020dfc69bafc</guid><dc:creator>tommy.park</dc:creator><description>&lt;p&gt;Thanks for the answer.&lt;br /&gt;It works fine for all other samples.&lt;br /&gt;An abnormal phenomenon occurred in one sample.&lt;br /&gt;Please give me more details about what you suggested.&lt;br /&gt;Since it is in the current product status, it is not possible to separate and debug.&lt;br /&gt;Please ask for more details for safe code in the future.&lt;br /&gt;An example sample that works well is attached.&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1611711455097v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291396?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 01:25:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37ae49df-5c17-4b97-a900-2a036a8c4b88</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;Woops,.....I never send or receive nus data with 0x00 or non-asci code. So I&amp;nbsp; am not sure your application is workable or not? But I suggest you the data with ascii code. Or apply the ble gatt function by yourself.&lt;/p&gt;
&lt;p&gt;For example&lt;/p&gt;
&lt;p&gt;nus rx data:&lt;/p&gt;
&lt;p&gt;0,0,a0,...........(length 20)string format not data hex format.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;using strtok() to pick up 3rd element.&lt;/p&gt;
&lt;p&gt;nus tx data:&lt;/p&gt;
&lt;p&gt;0,0,a0,........(length 20)&lt;/p&gt;
&lt;p&gt;using&amp;nbsp;&lt;span&gt;ble_nus_data_send ().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I had done the old project with nus before. You may follow my example as follow:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Our project command &amp;quot;CT&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nus rx data:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;CT bat&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nus tx data:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;CT bat_ack=aa&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;By the way, take care MTU setting , if your data length is longer than SDK example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291395?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 01:11:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e461a61-c123-44c8-a80e-29e5fab55dce</guid><dc:creator>tommy.park</dc:creator><description>&lt;p&gt;Thank you for answer.&lt;br /&gt;send_data_battery is 20 bytes, and &amp;amp;length is also fixed 20 bytes.&lt;br /&gt;Only the second byte of send_data_battery is in use. The rest is filled with 0x00.&lt;br /&gt;All samples operate normally, but ble_nus_data_send does not operate in one sample.&lt;/p&gt;
&lt;p&gt;Please refer to the attached picture above.&lt;br /&gt;It was received from APP, but the Length is 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291392?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 01:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8eff4b4d-8cad-4123-81dc-0f6d11c6ebb6</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;You mean that ble_nus_data_send() didn&amp;#39;t work, isn&amp;#39;t it?&lt;/p&gt;
&lt;p&gt;But I doubt your&amp;nbsp;&lt;span&gt;send_data_battery matrix definition.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;According to your project code,&amp;nbsp;BLE_FACTORY_START is equal to 0xa0.(According to your write char. 0x02)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And&amp;nbsp;send_data_battery&amp;nbsp;[2] equal to 0xa0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But you never define&amp;nbsp;길이(length) how can it work?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So you have to assign all of the send_data_battery elements, and the data matrix length.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When ble_nus_data_send does not work???</title><link>https://devzone.nordicsemi.com/thread/291391?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 00:45:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:417254dd-592c-44e4-b6de-9f7f00e91af4</guid><dc:creator>tommy.park</dc:creator><description>&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;개발 환경 : SDK 15.2.0 nRF52840&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>