<?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>Best way to debug bt_nus_send()?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89346/best-way-to-debug-bt_nus_send</link><description>Hi, I am testing out the UART Peripheral sample on the nRF52840 DK. Since I am communicating with another MCU, I have remapped the RX and TX pins to P0.26 and P0.27 respectively and set the baud rate to 9600. 
 I am using nRF Connect on Android to test</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Jun 2022 12:55:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89346/best-way-to-debug-bt_nus_send" /><item><title>RE: Best way to debug bt_nus_send()?</title><link>https://devzone.nordicsemi.com/thread/374543?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 12:55:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0b1dec6-8888-4f61-9f5a-645919c58e70</guid><dc:creator>Sigurd</dc:creator><description>[quote user="whyeye"]Regarding enabling notifications, I think the app has the icons backwards, see below:[/quote]
&lt;p&gt;When the notifications is disabled, you have the option to enable it by clicking the button:&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656420551156v1.png" alt=" " /&gt;&lt;br /&gt;&lt;span&gt;When the notifications is enabled, you have the option to&amp;nbsp;disable&amp;nbsp;it by clicking the button:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656420894254v3.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="whyeye"]&lt;p&gt;However, the RTT is still showing various warnings:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Try setting this in prj.confg, and then request longer MTU from the phone.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to debug bt_nus_send()?</title><link>https://devzone.nordicsemi.com/thread/374515?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 11:11:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67a47417-e362-4ff4-b97e-8991a933a521</guid><dc:creator>whyeye</dc:creator><description>&lt;p&gt;Thanks Sigurd. Regarding enabling notifications, I think the app has the icons backwards, see below:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656414341422v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656414401651v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Now, I found that if the value is set to &amp;quot;Notifications enabled&amp;quot; (0x01-00), I am actually receiving data on the client side. However, the RTT is still showing various warnings:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656414652075v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Can you provide any guidance on how to find the root cause?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to debug bt_nus_send()?</title><link>https://devzone.nordicsemi.com/thread/374447?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 06:56:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b91f9459-441f-4852-b7ee-fe3f6d3a5801</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I have enabled notifications on the client side so the issue isn&amp;#39;t that.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I assume you clicked the &amp;quot;Enable notifications&amp;quot; button then.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3021.pastedimage1656334865675v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Could you try to print the error-code? Try modifying the&amp;nbsp;ble_write_thread() so it looks something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_write_thread(void)
{
    int err = 0;
	/* Don&amp;#39;t go any further until BLE is initialized */
	k_sem_take(&amp;amp;ble_init_ok, K_FOREVER);

	for (;;) {
		/* Wait indefinitely for data to be sent over bluetooth */
		struct uart_data_t *buf = k_fifo_get(&amp;amp;fifo_uart_rx_data,
						     K_FOREVER);
        err = bt_nus_send(NULL, buf-&amp;gt;data, buf-&amp;gt;len);
		if (err) {
			LOG_WRN(&amp;quot;Failed to send data over BLE connection. Error: %d&amp;quot;,err);
		}

		k_free(buf);
	}
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to debug bt_nus_send()?</title><link>https://devzone.nordicsemi.com/thread/374422?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2022 23:21:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f1fcde9-2175-4133-889f-bb880c733508</guid><dc:creator>whyeye</dc:creator><description>&lt;p&gt;I got an email saying this ticket has been replied to, but I don&amp;#39;t see anything in this thread?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>