<?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 stream communication LOG errs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120780/ble-stream-communication-log-errs</link><description>Hi all, 
 I&amp;#39;ve been developing a BLE application on my laptop to communicate with the 52840. I manage to understand how to create and run a BLE connection through the really nice tutorial that has been posted a couple of years ago on youtube. https:/</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 May 2025 14:27:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120780/ble-stream-communication-log-errs" /><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/536804?ContentTypeID=1</link><pubDate>Fri, 23 May 2025 14:27:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:badff113-4d48-4fa7-b6bf-81a78da88182</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;thank you for taking the time to go through the log. I tried editing the connection interval through code and that actually brought some improvements (min 7.5ms max 10ms)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;bt_conn_le_param_update(current_conn, BT_LE_CONN_PARAM(6, 8, 0, 20));
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;which brings me to the question why editing&amp;nbsp;CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT didn&amp;#39;t gave me the same effect?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;given this behavior I went through implementing a manual MTU negotiation right before updating the parameters above&amp;nbsp;&lt;/p&gt;
&lt;p&gt;// full callback on connection&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void on_connected(struct bt_conn *conn, uint8_t err)
{
        if (err)
        {
                LOG_ERR(&amp;quot;connection err: %d&amp;quot;, err);
                return;
        }
        LOG_INF(&amp;quot;Connected.&amp;quot;);
        current_conn = bt_conn_ref(conn);

        /* maximize ATT MTU at peer side (CONFIG_BT_L2CAP_TX_MTU)*/
	static struct bt_gatt_exchange_params exchange_params;
        exchange_params.func = exchange_func;

        LOG_INF(&amp;quot;sending ATT MTU to peer..&amp;quot;);
        int rc = bt_gatt_exchange_mtu(current_conn, &amp;amp;exchange_params);
        if (rc)
        {
                LOG_ERR(&amp;quot;failed to negotiate maximum mtu with peer [%d]&amp;quot;, rc);
        }

        bt_conn_le_param_update(current_conn, BT_LE_CONN_PARAM(6, 8, 0, 20));
        
        dk_set_led_on(CONN_STATUS_LED);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in combination with the following prj.conf, I managed to have a stable stream of 1khz for 32 bytes with a worker running at 15 ms&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=7500

CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=1024
CONFIG_BT_BUF_ACL_TX_SIZE=512
CONFIG_BT_BUF_ACL_RX_SIZE=512
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;But the question is the same as above, why didn&amp;#39;t&amp;nbsp;CONFIG_BT_L2CAP_TX_MTU allowed a higher MTU buffer? Also the negotiated MTU is 505, not 1024.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Of course I managed this with a nrf52840 Dongle with the hci_usb project and the prj.conf edited to resemble the one of my project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/536669?ContentTypeID=1</link><pubDate>Thu, 22 May 2025 14:55:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37592f38-1ec8-482e-8eb0-5eebe8672c04</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&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/pastedimage1747925511131v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;At the start of the connection event, you as the&amp;nbsp;&lt;span&gt;peripheral have packets queued up, and the MD bit is set. But after a sending a few packets, the&amp;nbsp;packet queue is empty, you don&amp;#39;t have more data to send, and the connection event ends. Then you need to wait until the next connect event starts to send data. The connection interval is 45ms. Maybe you can try requesting a lower connection interval.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/535966?ContentTypeID=1</link><pubDate>Mon, 19 May 2025 11:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f1c0e92-b1ae-4702-83cd-6c2c8c35079e</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Following a possible different approach, I decided to transmit burst of data every x ms with&amp;nbsp; 1khz amount of data.&lt;br /&gt;&lt;br /&gt;I change the code to accommodate an array of 16 u16_t times the streaming in millisecond&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define RHD_MAX_CH_NUMBER 16 
#define RHD_TIMER_FREQ_MS 25


int send_stream_notification(struct bt_conn *conn, u16_t* value, size_t len)
{
    int err = 0;

    struct bt_gatt_notify_params params = {0};
    const struct bt_gatt_attr *attr = &amp;amp;rhxRemoteService.attrs[4];

    params.attr = attr;
    params.data = value;
    params.len = sizeof(u16_t) * len;
    params.func = on_stream;

    err = bt_gatt_notify_cb(conn, &amp;amp;params);

    return err;
}

void RHD_handler(struct k_work *work)
{
        u16_t RAMP[RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS];
        static u16_t count = 0;
        u8_t j = 0;
        for (j = 0; j &amp;lt; RHD_TIMER_FREQ_MS; j++) {
                for (u8_t i = 0; i &amp;lt; RHD_MAX_CH_NUMBER; i++) {
                        RAMP[j * RHD_MAX_CH_NUMBER + i] = count;
                }
                count = (count + 1) % 1000;
        }

        if (isStreamEnabled())
        {

                int err = send_stream_notification(current_conn, RAMP, RHD_MAX_CH_NUMBER * RHD_TIMER_FREQ_MS);
                if (err)
                {
                        LOG_ERR(&amp;quot;couldn&amp;#39;t send notification (err: %d)&amp;quot;, err);
                }
                

        }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With this approach I get an error about the inability of correctly negotiate the MTU&lt;br /&gt;&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/pastedimage1747655030507v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;my current prj.conf&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO=y
CONFIG_SPI=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# Configure logger
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_BUFFER_SIZE=4096

# Configure Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;XYZ&amp;quot;
CONFIG_BT_LL_SOFTDEVICE=y
CONFIG_BT_BUF_ACL_TX_COUNT=100
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y

CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=30000
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Trying to change&amp;nbsp;CONFIG_BT_L2CAP_TX_MTU didn&amp;#39;t improve the situation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/535586?ContentTypeID=1</link><pubDate>Thu, 15 May 2025 12:41:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e1087cd-247e-432d-8df0-1e54b49e295d</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;After searching around and testing different solutions, I still haven&amp;#39;t found anything useful unfortunately.&lt;br /&gt;I tested my worked and found out that can reach 25 ms stream (sill using a 16 element u16 array since this will be my actual output structure). below 25 ms the errors will start to arise.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any help would be much appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/534059?ContentTypeID=1</link><pubDate>Tue, 06 May 2025 08:28:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee3fa511-0d7f-46c9-8899-8281dbf7107b</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;here&amp;#39;s also the log of the captured stream.&lt;br /&gt;&lt;br /&gt;the UUID of the characteristic used for streaming is (&lt;span&gt;0x&lt;/span&gt;&lt;span&gt;f26200f3&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0x&lt;/span&gt;&lt;span&gt;bcb8&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0x&lt;/span&gt;&lt;span&gt;4366&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0x&lt;/span&gt;&lt;span&gt;9a9b&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;0x&lt;/span&gt;&lt;span&gt;a757edad68dc&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3617.capture.pcapng"&gt;devzone.nordicsemi.com/.../3617.capture.pcapng&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I see holes in the actual stream too.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/534052?ContentTypeID=1</link><pubDate>Tue, 06 May 2025 08:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bddeee9-4374-4684-8d30-ba59887c80bc</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;I mistakenly debugged the err value and it actually returns -12 (ENOMEM).&lt;br /&gt;I&amp;#39;m trying the sniffer but I have issues on filtering through wireshark since I cannot see the UUID.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/533497?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2025 06:52:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8c1edeb-9ee8-4a08-bdcd-553dd550b56a</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Hi SIgurd,&lt;/p&gt;
&lt;p&gt;1) The err value is actually always 0&lt;/p&gt;
&lt;p&gt;2) I tried it also with 30000 and 40000 but had no effect.&lt;/p&gt;
&lt;p&gt;3) I never did that, please allow me some time to learn it and test it! (I&amp;#39;ll be back with possible results next week due to holidays)&lt;/p&gt;
&lt;p&gt;Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/533446?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2025 15:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1078fb73-045d-4617-af39-143af0e057c0</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;1) Could you print the return value of&amp;nbsp;send_stream_notification() ?&lt;/p&gt;
&lt;p&gt;2) Try also setting&amp;nbsp;&lt;span&gt;BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT to e.g.&amp;nbsp;30000&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3) Could you capture a sniffer trace ?&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le&lt;/a&gt;&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: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/533126?ContentTypeID=1</link><pubDate>Mon, 28 Apr 2025 07:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:667b037e-ba36-4629-a649-22834729d110</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;sorry for the late reply. Here are some snippets of my code.&lt;/p&gt;
&lt;p&gt;prj.conf&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_FPU=y
CONFIG_NEWLIB_LIBC=y
CONFIG_CBPRINTF_FP_SUPPORT=y

# Set CONFIG_NEWLIB_LIBC_FLOAT_PRINTF if printf should be able to print float
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# Configure logger
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_BUFFER_SIZE=4096

# Configure Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;XYZ&amp;quot;
CONFIG_BT_MAX_CONN=1
CONFIG_BT_LL_SOFTDEVICE=y
CONFIG_CAF_BLE_USE_LLPM=y

CONFIG_BT_SMP=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_ATT_TX_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_BUF_ACL_RX_SIZE=502

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y

CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=1000
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The remote.c file that came with the webinar (edited to accommodate my &amp;quot;stream&amp;quot; characteristic). The send_stream_notification function is the one I use.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
#include &amp;quot;comm/remote.h&amp;quot;

#define LOG_MODULE_NAME_REMOTE Remote_BLE
LOG_MODULE_REGISTER(LOG_MODULE_NAME_REMOTE);

/* Declarations */
static K_SEM_DEFINE(bt_init_ok, 1, 1);

#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)

static const struct bt_data ad[] = {
    BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN)};

static const struct bt_data sd[] = {
    BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_REMOTE_SERV_VAL),
};

static uint8_t button_value = 0;
static u16_t stream_value[27];
enum bt_notifications_enabled notifications_enabled;
static struct bt_remote_service_cb remote_callbacks;

void on_sent(struct bt_conn *conn, void *user_data);
void on_stream(struct bt_conn *conn, void *user_data);

static ssize_t read_rhd_characteristic_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
                                          void *buf, uint16_t len, uint16_t offset);

static ssize_t read_rhd_stream_characteristic_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
                                                 void *buf, uint16_t len, uint16_t offset);

void button_chrc_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value);

void stream_chrc_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value);

static ssize_t on_write(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags);

BT_GATT_SERVICE_DEFINE(rhxRemoteService,
                       BT_GATT_PRIMARY_SERVICE(BT_UUID_REMOTE_SERVICE),
                       BT_GATT_CHARACTERISTIC(BT_UUID_REMOTE_BUTTON_CHRC,
                                              BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
                                              BT_GATT_PERM_READ,
                                              read_rhd_characteristic_cb, NULL, NULL),
                       BT_GATT_CCC(button_chrc_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
                       BT_GATT_CHARACTERISTIC(BT_UUID_REMOTE_STREAM_CHRC,
                                              BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
                                              BT_GATT_PERM_READ,
                                              read_rhd_stream_characteristic_cb, NULL, NULL),
                       BT_GATT_CCC(stream_chrc_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
                       BT_GATT_CHARACTERISTIC(BT_UUID_REMOTE_MESSAGE_CHRC,
                                              BT_GATT_CHRC_WRITE_WITHOUT_RESP,
                                              BT_GATT_PERM_READ | BT_GATT_PERM_WRITE,
                                              NULL, on_write, NULL), );

/* Callbacks */

static ssize_t read_rhd_characteristic_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
                                          void *buf, uint16_t len, uint16_t offset)
{
    return bt_gatt_attr_read(conn, attr, buf, len, offset, &amp;amp;button_value,
                             sizeof(button_value));
}

static ssize_t read_rhd_stream_characteristic_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
                                                 void *buf, uint16_t len, uint16_t offset)
{
    return bt_gatt_attr_read(conn, attr, buf, len, offset, &amp;amp;stream_value,
                             sizeof(stream_value));
}

void button_chrc_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
{
    bool notif_enabled = (value == BT_GATT_CCC_NOTIFY);
    LOG_INF(&amp;quot;Notifications %s (button)&amp;quot;, notif_enabled ? &amp;quot;enabled&amp;quot; : &amp;quot;disabled&amp;quot;);

    notifications_enabled = notif_enabled ? BT_NOTIFICATIONS_ENABLED : BT_NOTIFICATIONS_DISABLED;
}

void stream_chrc_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
{
    bool notif_enabled = (value == BT_GATT_CCC_NOTIFY);
    LOG_INF(&amp;quot;Notifications %s (stream)&amp;quot;, notif_enabled ? &amp;quot;enabled&amp;quot; : &amp;quot;disabled&amp;quot;);

    notifications_enabled = notif_enabled ? BT_NOTIFICATIONS_ENABLED : BT_NOTIFICATIONS_DISABLED;
}

int send_button_notification(struct bt_conn *conn, uint8_t value)
{
    int err = 0;

    struct bt_gatt_notify_params params = {0};
    const struct bt_gatt_attr *attr = &amp;amp;rhxRemoteService.attrs[2];

    params.attr = attr;
    params.data = &amp;amp;value;
    params.len = 1;
    params.func = on_sent;

    err = bt_gatt_notify_cb(conn, &amp;amp;params);

    return err;
}

int send_stream_notification(struct bt_conn *conn, u16_t* value)
{
    int err = 0;

    struct bt_gatt_notify_params params = {0};
    const struct bt_gatt_attr *attr = &amp;amp;rhxRemoteService.attrs[4];

    params.attr = attr;
    params.data = value;
    params.len = sizeof(u16_t) * 16;
    params.func = on_stream;

    err = bt_gatt_notify_cb(conn, &amp;amp;params);

    return err;
}

static ssize_t on_write(struct bt_conn *conn,
                        const struct bt_gatt_attr *attr,
                        const void *buf,
                        uint16_t len,
                        uint16_t offset,
                        uint8_t flags)
{
    LOG_INF(&amp;quot;Received data, handle %d, conn %p&amp;quot;,
            attr-&amp;gt;handle, (void *)conn);

    if (remote_callbacks.data_received)
    {
        remote_callbacks.data_received(conn, buf, len);
    }
    return len;
}

void on_sent(struct bt_conn *conn, void *user_data)
{
    ARG_UNUSED(user_data);
    LOG_INF(&amp;quot;Notification sent on connection %p&amp;quot;, (void *)conn);
}

void on_stream(struct bt_conn *conn, void *user_data)
{
    ARG_UNUSED(user_data);
    //LOG_INF(&amp;quot;Notification sent on connection %p&amp;quot;, (void *)conn); // uncomment for debugging. avoids flooding the log
}

void set_button_value(uint8_t btn_value)
{
    button_value = btn_value;
}

void set_stream_value(u16_t* str_value)
{
    for (int i = 0; i &amp;lt; 27; i++)
    {
        stream_value[i] = str_value[i];
    }
}

void bt_ready(int err)
{
    if (err)
    {
        LOG_ERR(&amp;quot;bt_enable returned %d&amp;quot;, err);
    }

    k_sem_give(&amp;amp;bt_init_ok);
}

/* Custom functions */

int bluetooth_init(struct bt_conn_cb *bt_cb, struct bt_remote_service_cb *remote_cb)
{
    LOG_INF(&amp;quot;Initializing Bluetooth&amp;quot;);

    if (bt_cb == NULL || remote_cb == NULL)
    {
        return -NRFX_ERROR_NULL;
    }
    bt_conn_cb_register(bt_cb);
    remote_callbacks.notif_changed = remote_cb-&amp;gt;notif_changed;
    remote_callbacks.data_received = remote_cb-&amp;gt;data_received;

    int err = bt_enable(bt_ready);
    if (err)
    {
        LOG_ERR(&amp;quot;bt_enable returned %d&amp;quot;, err);
        return err;
    }

    k_sem_take(&amp;amp;bt_init_ok, K_FOREVER);

    err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
    if (err)
    {
        LOG_ERR(&amp;quot;couldn&amp;#39;t start advertising (err = %d&amp;quot;, err);
        return err;
    }

    return err;
}

bool STREAM = false;

void enableStream(void)
{
    STREAM = true;
}
void disableStream(void)
{
    STREAM = false;
}
bool isStreamEnabled(void)
{
    return STREAM;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the main.c file where the worker is instantiated and calls the stream function&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/sys/printk.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;zephyr/drivers/spi.h&amp;gt;
#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;dk_buttons_and_leds.h&amp;gt;
#include &amp;lt;math.h&amp;gt;

#include &amp;quot;hal/rhd2216.h&amp;quot;
#include &amp;quot;comm/remote.h&amp;quot;

#define LOG_MODULE_NAME_MAIN RHX_comm_main
LOG_MODULE_REGISTER(LOG_MODULE_NAME_MAIN);
#define RUN_STATUS_LED DK_LED1
#define CONN_STATUS_LED DK_LED2
#define RUN_LED_BLINK_INTERVAL 1000

/* Worker */


/*
 * cb function define
 */
// timer cb
// using round-robin fashion ,a timer callback to sample all needed channels
void RHD_handler(struct k_work *work)
{
        u16_t RAMP[16];
        uint64_t stamp;
        stamp = k_uptime_get_32();

        static u16_t count = 0;
        for(u16_t i = 0; i &amp;lt; 16; i++)
        {
                RAMP[i] = count;
        }

        count = (count + 1) % 1000;

        if (isStreamEnabled())
        {

                int err = send_stream_notification(current_conn, RAMP);
                if (err)
                {
                        // LOG_ERR(&amp;quot;couldn&amp;#39;t send notification (err: %d)&amp;quot;, err);
                }
                

        }
}


/* Declarations */

void on_connected(struct bt_conn *conn, uint8_t err);
void on_disconnected(struct bt_conn *conn, uint8_t reason);
void on_notif_changed(enum bt_notifications_enabled status);
void on_data_received(struct bt_conn *conn, const uint8_t *const data, uint16_t len);

static struct bt_conn *current_conn;

struct bt_conn_cb bluetooth_callbacks = {
    .connected = on_connected,
    .disconnected = on_disconnected,
};

struct bt_remote_service_cb remote_callbacks = {
    .notif_changed = on_notif_changed,
    .data_received = on_data_received,
};

/* Callbacks */

void on_data_received(struct bt_conn *conn, const uint8_t *const data, uint16_t len)
{
        uint8_t temp_str[len + 1];
        memcpy(temp_str, data, len);
        temp_str[len] = 0x00;

        LOG_INF(&amp;quot;Received data on conn %p. Len: %d&amp;quot;, (void *)conn, len);
        LOG_INF(&amp;quot;Data: %s&amp;quot;, temp_str);
}

void on_notif_changed(enum bt_notifications_enabled status)
{
        if (status == BT_NOTIFICATIONS_ENABLED)
        {
                LOG_INF(&amp;quot;Notifications enabled&amp;quot;);
        }
        else
        {
                LOG_INF(&amp;quot;Notificatons disabled&amp;quot;);
        }
}

void on_connected(struct bt_conn *conn, uint8_t err)
{
        if (err)
        {
                LOG_ERR(&amp;quot;connection err: %d&amp;quot;, err);
                return;
        }
        LOG_INF(&amp;quot;Connected.&amp;quot;);
        current_conn = bt_conn_ref(conn);
        dk_set_led_on(CONN_STATUS_LED);
}

void on_disconnected(struct bt_conn *conn, uint8_t reason)
{
        LOG_INF(&amp;quot;Disconnected (reason: %d)&amp;quot;, reason);
        dk_set_led_off(CONN_STATUS_LED);
        if (current_conn)
        {
                bt_conn_unref(current_conn);
                current_conn = NULL;
        }
}

void button_handler(uint32_t button_state, uint32_t has_changed)
{
        int button_pressed = 0;
        if (has_changed &amp;amp; button_state)
        {
                switch (has_changed)
                {
                case DK_BTN1_MSK:
                        button_pressed = 1;
                        enableStream();
                        break;
                case DK_BTN2_MSK:
                        button_pressed = 2;
                        disableStream();
                        break;
                case DK_BTN3_MSK:
                        button_pressed = 3;
                        disableStream();
                        break;
                case DK_BTN4_MSK:
                        button_pressed = 4;
                        disableStream();
                        break;
                default:
                        break;
                }
                LOG_INF(&amp;quot;Button %d pressed.&amp;quot;, button_pressed);
                set_button_value(button_pressed);
                int err = send_button_notification(current_conn, button_pressed);
                if (err)
                {
                        LOG_ERR(&amp;quot;couldn&amp;#39;t send notification (err: %d)&amp;quot;, err);
                }
        }
}

// timer
struct k_timer RHD_timer;

// LED Blinky
static const struct gpio_dt_spec LED_dev = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
bool led_is_on = true;
int ret_LED;

/*
 * function define
 */

// timer function
K_WORK_DEFINE(work_rhd, RHD_handler); // define RHD_handler as my_work
void rhd_timer_handler(struct k_timer *dummy)
{
        k_work_submit(&amp;amp;work_rhd);
}

static void configure_dk_buttons_leds(void)
{
        int err;

        err = dk_buttons_init(button_handler);
        if (err)
        {
                LOG_ERR(&amp;quot;Cannot init buttons (err: %d)&amp;quot;, err);
        }
        err = dk_leds_init();
        if (err)
        {
                LOG_ERR(&amp;quot;Cannot init LEDs (err: %d)&amp;quot;, err);
        }
}

/*
 * main function loop
 */
int main(void)
{

        k_msleep(1000);

        /*
         * setup
         */
        // Buttons sdk EVK
        configure_dk_buttons_leds();

        int err = bluetooth_init(&amp;amp;bluetooth_callbacks, &amp;amp;remote_callbacks);
        if (err)
        {
                LOG_ERR(&amp;quot;bt_enable returned %d&amp;quot;, err);
                goto _error;
        }

        // timer
        k_timer_init(&amp;amp;RHD_timer, rhd_timer_handler, NULL); // init timer

        // Extract the device driver implementation
        LOG_INF(&amp;quot;Extract the device driver implementation&amp;quot;);
        if (!gpio_is_ready_dt(&amp;amp;LED_dev))
        {
                LOG_ERR(&amp;quot;Issue on device_get_binding\n&amp;quot;);
                goto _error;
        }

        // Configure the GPIO pin
        LOG_INF(&amp;quot;Configure the GPIO pin&amp;quot;);
        err = gpio_pin_configure_dt(&amp;amp;LED_dev, GPIO_OUTPUT_ACTIVE);
        if (err &amp;lt; 0)
        {
                LOG_ERR(&amp;quot;Issue on gpio_pin_configure %d&amp;quot;, err);
                goto _error;
        }

        // RHD
        LOG_INF(&amp;quot;RHD2216_init&amp;quot;);
        err = RHD2216_init();
        if (err)
        {
                LOG_ERR(&amp;quot;RHD2216 init fail %d&amp;quot;, err);
        }
        else
        {
                RHD2216_set_bt_current_conn(current_conn);
                err = RHD2216_start_convert();
                if (err)
                {
                        LOG_ERR(&amp;quot;RHD2216 start convert failed %d&amp;quot;, err);
                }
                else
                {
                        /* start periodic timer that expires once at 1kHz */
                        k_timer_start(&amp;amp;RHD_timer, K_SECONDS(3), K_MSEC(1)); // first param is timer duration(initial timer duration)
                }
        }

        bool led_state = true;

        while (true)
        {
                int ret = gpio_pin_toggle_dt(&amp;amp;LED_dev);
                if (ret &amp;lt; 0)
                {
                        return 0;
                }

                led_state = !led_state;

                // printf(&amp;quot;LED state: %s\n&amp;quot;, led_state ? &amp;quot;ON&amp;quot; : &amp;quot;OFF&amp;quot;);
                k_msleep(1);
                // printk(&amp;quot;This is main loop! \n&amp;quot;);
        }

        return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Right now the worker just send a 16 uint16_t vector of incrementing values (0-1000) every 1ms.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;On the other side I have a GUI implemented with pyside6 (python-Qt) that uses the onboard bt adapter of my laptop (Bluetooth 5.2). I did a quick experiment by using the nRF52840-Dongle (hci-usb sample project flashed) as adapter but had no improvements.&lt;br /&gt;&lt;br /&gt;Thanks again for you time!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532869?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 14:45:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a613674-60d9-427a-957e-e34382fd6ed1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Could you post some code snippets that shows how you send your data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532852?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 13:44:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5e9b4f9-ed23-47e2-ad92-b12d9fa2a518</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;I found the setting&amp;nbsp;CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT from other nRF samples.&lt;br /&gt;&lt;br /&gt;Since I was not using it, it should have been set to the default of 7.5 ms. I tried to set it to its lower value (2500) but nothing changed.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532849?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 13:34:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3d44040-84c1-4fc5-ae18-9461d6e284ec</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;I&amp;#39;m using SDK 2.9. I even implemented the full array of 16 uin16_t to be streamed and I have no issues at 200ms. Even at 50ms works fine, but I am unable to reach 1ms.&lt;br /&gt;&lt;br /&gt;Incrementing the log buffer didn&amp;#39;t change anything in the output and the log prints report the same error.&lt;br /&gt;&lt;br /&gt;How can I change the BLE connection interval?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532843?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 13:23:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aabe6a60-4886-4b05-958b-2dc30601c3fb</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;1) What SDK version are you using?&lt;/p&gt;
&lt;p&gt;2) What BLE connection interval are you using?&lt;/p&gt;
[quote user=""]I am streaming data out from a worker that runs at 1ms and sends a single uint16 packet[/quote]
&lt;p&gt;3) Just for testing, if you send it at e.g. 200ms instead, do you see the same issue then?&lt;/p&gt;
&lt;p&gt;4) For the logs dropped, could you try to increase CONFIG_LOG_BUFFER_SIZE to e.g. 4096?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532810?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 11:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b36a31c6-0e22-431e-b25a-bd870727e1d7</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;thanks for the reply. Unfortunately that had no effect, I still have missing data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532789?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 10:53:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c9c0dea-5fef-4a53-b8c0-ccdc7db1de7c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;You could try to increase some BLE related buffers.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_ATT_TX_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=502

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE stream communication LOG errs</title><link>https://devzone.nordicsemi.com/thread/532166?ContentTypeID=1</link><pubDate>Fri, 18 Apr 2025 12:44:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cb56322-d5c2-4c7f-9dd5-dd7471efaa39</guid><dc:creator>Sam-IIT</dc:creator><description>&lt;p&gt;Going on I just started by streaming a basic 0-1000 ramp in this 1 ms worker and I definitely have holes.&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/pastedimage1744980184498v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So I think those issues are actually related to the ble stream (I also turned off the logging).&lt;br /&gt;Anyone has any idea where can I dig into in order to improve such performances? if possible...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>