<?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>Use of nus_data_send() in user made data send function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44059/use-of-nus_data_send-in-user-made-data-send-function</link><description>Hi everyone, 
 I want to transmit a HEX array I read from a peripheral using SPI communication (I initialize my RX_BUF in the SPI_EVT_HANDLER() function) via BLE. I am using a mobile app (nrfConnect and nrf Toolbox) to receive data from the device. The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Feb 2019 15:15:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44059/use-of-nus_data_send-in-user-made-data-send-function" /><item><title>RE: Use of nus_data_send() in user made data send function</title><link>https://devzone.nordicsemi.com/thread/172833?ContentTypeID=1</link><pubDate>Mon, 25 Feb 2019 15:15:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e1d8ee8-5d76-4fd1-8e83-7d4c2038b88e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you see something doesn&amp;#39;t work as expected. Please try to debug.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To debug in this case you would need to check the return code of the API(s) you call,&amp;nbsp;ble_nus_data_send() . YOu need to check if it return err_code = NRF_SUCCESS or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can also step into the code and see which exact function return the error code if it&amp;#39;s not normal (NRF_SUCCESS). Most likely the error comes from&amp;nbsp;sd_ble_gatts_hvx() and then you can have a look at the description of the function and have a suggestion on why that happened.&lt;/p&gt;
&lt;p&gt;I would suspect that it was because the connection has not been established and the CCCD (notification) was not enabled.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>