<?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>ble periheral uart</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84332/ble-periheral-uart</link><description>Hi, 
 On the nRF5340-DK, i&amp;#39;m succesfuly using the example code: 
 https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html 
 
 ..now i would like to alter some.. 
 in the void ble_write_thread ( void</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Feb 2022 20:56:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84332/ble-periheral-uart" /><item><title>RE: ble periheral uart</title><link>https://devzone.nordicsemi.com/thread/351644?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 20:56:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c367ced1-601d-48cb-8e33-461a19399093</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I did replace co cod as you mentioned.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It Works OK !!&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Theo&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble periheral uart</title><link>https://devzone.nordicsemi.com/thread/351471?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 08:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05731329-0151-4738-9ec3-92817e134710</guid><dc:creator>TF mulder</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks Edvin.&lt;/p&gt;
&lt;p&gt;For now i did &amp;#39;bypass&amp;#39; the problem, by sending a own command/data (Via the RX-charactaristic)) to set an EnableFlag to start the sending of Data via the TX-Charateristic.&lt;/p&gt;
&lt;p&gt;Im very happy with you answer, i wil look into it in more detail later.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Manny thanks Edvin,&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Theo&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble periheral uart</title><link>https://devzone.nordicsemi.com/thread/351114?ContentTypeID=1</link><pubDate>Thu, 03 Feb 2022 13:18:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:715d1aa0-e9f1-4740-992b-73bcbb3700ae</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If your question is in fact how to know when the central has enabled the notifications for your tx characteristic, then please check out nus.c, and see where the service is declared using:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* UART Service Declaration */
BT_GATT_SERVICE_DEFINE(nus_svc,
BT_GATT_PRIMARY_SERVICE(BT_UUID_NUS_SERVICE),
	BT_GATT_CHARACTERISTIC(BT_UUID_NUS_TX,
			       BT_GATT_CHRC_NOTIFY,
			       BT_GATT_PERM_READ,
			       NULL, NULL, NULL),
	BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
	BT_GATT_CHARACTERISTIC(BT_UUID_NUS_RX,
			       BT_GATT_CHRC_WRITE |
			       BT_GATT_CHRC_WRITE_WITHOUT_RESP,
			       BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,
			       NULL, on_receive, NULL),
);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;On the line BT_GATT_CCC(nus_ccc_cfg_changed, BT_GATT_PERM_READ | |BT_GATT_PERM_WRITE), nus_ccc_cfg_changed is the callback whenever notifications are enabled/disabled for the TX characteristic. Looking at this callback which is implemented in the same file (nus.c), it will trigger a callback if the callback nus_cb.send_enabled() is set.&lt;/p&gt;
&lt;p&gt;This is set in bt_nus_init().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking at where bt_nus_init() is called from main.c, you can see that nus_cb is also declared in main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static struct bt_nus_cb nus_cb = {
	.received = bt_receive_cb,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;however, only the .received is populated, and hence the .send_enabled() callback is not pupulated, and not called when the nus_ccc_cfg_changed is triggered.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Try replacing:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static struct bt_nus_cb nus_cb = {
	.received = bt_receive_cb,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;with:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void bt_send_enabled(enum bt_nus_send_status status)
{
    LOG_INF(&amp;quot;notification callback&amp;quot;);
    LOG_INF(&amp;quot;notifications %s&amp;quot;, (status==BT_NUS_SEND_STATUS_ENABLED)?&amp;quot;enabled&amp;quot;:&amp;quot;disabled&amp;quot;);
}

static struct bt_nus_cb nus_cb = {
	.received = bt_receive_cb,
    .send_enabled = bt_send_enabled,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It should print in the log whenever the notification status changes, and whether it is enabled or disabled.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>