<?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>Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90951/bluetooth-rpc-stack-hangs-when-running-a-second-ble-scan</link><description>Hello, 
 I am working on developing an application on the NRF5340 development kit which scans for nearby BLE beacons. I am using the Bluetooth RPC Stack for communication between the network core and the application core. Scanning works completely as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Oct 2022 14:21:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90951/bluetooth-rpc-stack-hangs-when-running-a-second-ble-scan" /><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/389237?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 14:21:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cde8e30-bb07-4f14-8eda-5abf167e7e3b</guid><dc:creator>Amr Moussa</dc:creator><description>&lt;p&gt;After inspecting your code I was able to resolve the issue. The problem is that I was calling bt_le_scan_stop() in a timer handler thread. If my understanding is correct, timer handlers are &amp;quot;interrupt threads&amp;quot; which do not get to live for very long, and it seems not long enough to properly shut down BLE scanning. I moved my bt_le_scan_stop() call into a work queue job that is submitted to the queue from the timer handler and that resolved the issue. Thank you for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/387894?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 11:53:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:526f5496-1774-424c-be3e-d18f8ea8f042</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;I&amp;#39;m not able to reproduce it.&lt;/p&gt;
&lt;p&gt;I tried using central_uart sample with some modification. Here is the code I used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

/** @file
 *  @brief Nordic UART Service Client sample
 */

#include &amp;lt;errno.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/sys/byteorder.h&amp;gt;
#include &amp;lt;zephyr/sys/printk.h&amp;gt;

#include &amp;lt;zephyr/types.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;

#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/hci.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/conn.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/gatt.h&amp;gt;

#include &amp;lt;bluetooth/services/nus.h&amp;gt;
#include &amp;lt;bluetooth/services/nus_client.h&amp;gt;
#include &amp;lt;bluetooth/gatt_dm.h&amp;gt;
#include &amp;lt;bluetooth/scan.h&amp;gt;

#include &amp;lt;zephyr/settings/settings.h&amp;gt;

#include &amp;lt;zephyr/drivers/uart.h&amp;gt;

#include &amp;lt;zephyr/logging/log.h&amp;gt;

#define LOG_MODULE_NAME central_uart
LOG_MODULE_REGISTER(LOG_MODULE_NAME);

/* UART payload buffer element size. */
#define UART_BUF_SIZE 20

#define KEY_PASSKEY_ACCEPT DK_BTN1_MSK
#define KEY_PASSKEY_REJECT DK_BTN2_MSK

#define NUS_WRITE_TIMEOUT K_MSEC(150)
#define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
#define UART_RX_TIMEOUT 50

static const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(uart0));
static struct k_work_delayable uart_work;

K_SEM_DEFINE(nus_write_sem, 0, 1);

struct uart_data_t {
	void *fifo_reserved;
	uint8_t  data[UART_BUF_SIZE];
	uint16_t len;
};

static K_FIFO_DEFINE(fifo_uart_tx_data);
static K_FIFO_DEFINE(fifo_uart_rx_data);

static struct bt_conn *default_conn;
static struct bt_nus_client nus_client;

static void ble_data_sent(struct bt_nus_client *nus, uint8_t err,
					const uint8_t *const data, uint16_t len)
{
	ARG_UNUSED(nus);

	struct uart_data_t *buf;

	/* Retrieve buffer context. */
	buf = CONTAINER_OF(data, struct uart_data_t, data);
	k_free(buf);

	k_sem_give(&amp;amp;nus_write_sem);

	if (err) {
		LOG_WRN(&amp;quot;ATT error code: 0x%02X&amp;quot;, err);
	}
}

static uint8_t ble_data_received(struct bt_nus_client *nus,
						const uint8_t *data, uint16_t len)
{
	ARG_UNUSED(nus);

	int err;

	for (uint16_t pos = 0; pos != len;) {
		struct uart_data_t *tx = k_malloc(sizeof(*tx));

		if (!tx) {
			LOG_WRN(&amp;quot;Not able to allocate UART send data buffer&amp;quot;);
			return BT_GATT_ITER_CONTINUE;
		}

		/* Keep the last byte of TX buffer for potential LF char. */
		size_t tx_data_size = sizeof(tx-&amp;gt;data) - 1;

		if ((len - pos) &amp;gt; tx_data_size) {
			tx-&amp;gt;len = tx_data_size;
		} else {
			tx-&amp;gt;len = (len - pos);
		}

		memcpy(tx-&amp;gt;data, &amp;amp;data[pos], tx-&amp;gt;len);

		pos += tx-&amp;gt;len;

		/* Append the LF character when the CR character triggered
		 * transmission from the peer.
		 */
		if ((pos == len) &amp;amp;&amp;amp; (data[len - 1] == &amp;#39;\r&amp;#39;)) {
			tx-&amp;gt;data[tx-&amp;gt;len] = &amp;#39;\n&amp;#39;;
			tx-&amp;gt;len++;
		}

		err = uart_tx(uart, tx-&amp;gt;data, tx-&amp;gt;len, SYS_FOREVER_MS);
		if (err) {
			k_fifo_put(&amp;amp;fifo_uart_tx_data, tx);
		}
	}

	return BT_GATT_ITER_CONTINUE;
}

static void uart_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	ARG_UNUSED(dev);

	static size_t aborted_len;
	struct uart_data_t *buf;
	static uint8_t *aborted_buf;
	static bool disable_req;

	switch (evt-&amp;gt;type) {
	case UART_TX_DONE:
		LOG_DBG(&amp;quot;UART_TX_DONE&amp;quot;);
		if ((evt-&amp;gt;data.tx.len == 0) ||
		    (!evt-&amp;gt;data.tx.buf)) {
			return;
		}

		if (aborted_buf) {
			buf = CONTAINER_OF(aborted_buf, struct uart_data_t,
					   data);
			aborted_buf = NULL;
			aborted_len = 0;
		} else {
			buf = CONTAINER_OF(evt-&amp;gt;data.tx.buf,
					   struct uart_data_t,
					   data);
		}

		k_free(buf);

		buf = k_fifo_get(&amp;amp;fifo_uart_tx_data, K_NO_WAIT);
		if (!buf) {
			return;
		}

		if (uart_tx(uart, buf-&amp;gt;data, buf-&amp;gt;len, SYS_FOREVER_MS)) {
			LOG_WRN(&amp;quot;Failed to send data over UART&amp;quot;);
		}

		break;

	case UART_RX_RDY:
		LOG_DBG(&amp;quot;UART_RX_RDY&amp;quot;);
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart_data_t, data);
		buf-&amp;gt;len += evt-&amp;gt;data.rx.len;

		if (disable_req) {
			return;
		}

		if ((evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\n&amp;#39;) ||
		    (evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\r&amp;#39;)) {
			disable_req = true;
			uart_rx_disable(uart);
		}

		break;

	case UART_RX_DISABLED:
		LOG_DBG(&amp;quot;UART_RX_DISABLED&amp;quot;);
		disable_req = false;

		buf = k_malloc(sizeof(*buf));
		if (buf) {
			buf-&amp;gt;len = 0;
		} else {
			LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
			k_work_reschedule(&amp;amp;uart_work, UART_WAIT_FOR_BUF_DELAY);
			return;
		}

		uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data),
			       UART_RX_TIMEOUT);

		break;

	case UART_RX_BUF_REQUEST:
		LOG_DBG(&amp;quot;UART_RX_BUF_REQUEST&amp;quot;);
		buf = k_malloc(sizeof(*buf));
		if (buf) {
			buf-&amp;gt;len = 0;
			uart_rx_buf_rsp(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data));
		} else {
			LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		}

		break;

	case UART_RX_BUF_RELEASED:
		LOG_DBG(&amp;quot;UART_RX_BUF_RELEASED&amp;quot;);
		buf = CONTAINER_OF(evt-&amp;gt;data.rx_buf.buf, struct uart_data_t,
				   data);

		if (buf-&amp;gt;len &amp;gt; 0) {
			k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		} else {
			k_free(buf);
		}

		break;

	case UART_TX_ABORTED:
		LOG_DBG(&amp;quot;UART_TX_ABORTED&amp;quot;);
		if (!aborted_buf) {
			aborted_buf = (uint8_t *)evt-&amp;gt;data.tx.buf;
		}

		aborted_len += evt-&amp;gt;data.tx.len;
		buf = CONTAINER_OF(aborted_buf, struct uart_data_t,
				   data);

		uart_tx(uart, &amp;amp;buf-&amp;gt;data[aborted_len],
			buf-&amp;gt;len - aborted_len, SYS_FOREVER_MS);

		break;

	default:
		break;
	}
}

static void uart_work_handler(struct k_work *item)
{
	struct uart_data_t *buf;

	buf = k_malloc(sizeof(*buf));
	if (buf) {
		buf-&amp;gt;len = 0;
	} else {
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}

	uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data), UART_RX_TIMEOUT);
}

static int uart_init(void)
{
	int err;
	struct uart_data_t *rx;

	if (!device_is_ready(uart)) {
		LOG_ERR(&amp;quot;UART device not ready&amp;quot;);
		return -ENODEV;
	}

	rx = k_malloc(sizeof(*rx));
	if (rx) {
		rx-&amp;gt;len = 0;
	} else {
		return -ENOMEM;
	}

	k_work_init_delayable(&amp;amp;uart_work, uart_work_handler);

	err = uart_callback_set(uart, uart_cb, NULL);
	if (err) {
		return err;
	}

	return uart_rx_enable(uart, rx-&amp;gt;data, sizeof(rx-&amp;gt;data),
			      UART_RX_TIMEOUT);
}

static void discovery_complete(struct bt_gatt_dm *dm,
			       void *context)
{
	struct bt_nus_client *nus = context;
	LOG_INF(&amp;quot;Service discovery completed&amp;quot;);

	bt_gatt_dm_data_print(dm);

	bt_nus_handles_assign(dm, nus);
	bt_nus_subscribe_receive(nus);

	bt_gatt_dm_data_release(dm);
}

static void discovery_service_not_found(struct bt_conn *conn,
					void *context)
{
	LOG_INF(&amp;quot;Service not found&amp;quot;);
}

static void discovery_error(struct bt_conn *conn,
			    int err,
			    void *context)
{
	LOG_WRN(&amp;quot;Error while discovering GATT database: (%d)&amp;quot;, err);
}

struct bt_gatt_dm_cb discovery_cb = {
	.completed         = discovery_complete,
	.service_not_found = discovery_service_not_found,
	.error_found       = discovery_error,
};

static void gatt_discover(struct bt_conn *conn)
{
	int err;

	if (conn != default_conn) {
		return;
	}

	err = bt_gatt_dm_start(conn,
			       BT_UUID_NUS_SERVICE,
			       &amp;amp;discovery_cb,
			       &amp;amp;nus_client);
	if (err) {
		LOG_ERR(&amp;quot;could not start the discovery procedure, error &amp;quot;
			&amp;quot;code: %d&amp;quot;, err);
	}
}

static void exchange_func(struct bt_conn *conn, uint8_t err, struct bt_gatt_exchange_params *params)
{
	if (!err) {
		LOG_INF(&amp;quot;MTU exchange done&amp;quot;);
	} else {
		LOG_WRN(&amp;quot;MTU exchange failed (err %&amp;quot; PRIu8 &amp;quot;)&amp;quot;, err);
	}
}

static void connected(struct bt_conn *conn, uint8_t conn_err)
{
	char addr[BT_ADDR_LE_STR_LEN];
	int err;

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (conn_err) {
		LOG_INF(&amp;quot;Failed to connect to %s (%d)&amp;quot;, addr, conn_err);

		if (default_conn == conn) {
			bt_conn_unref(default_conn);
			default_conn = NULL;

			err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
			if (err) {
				LOG_ERR(&amp;quot;Scanning failed to start (err %d)&amp;quot;,
					err);
			}
		}

		return;
	}

	LOG_INF(&amp;quot;Connected: %s&amp;quot;, addr);

	static struct bt_gatt_exchange_params exchange_params;

	exchange_params.func = exchange_func;
	err = bt_gatt_exchange_mtu(conn, &amp;amp;exchange_params);
	if (err) {
		LOG_WRN(&amp;quot;MTU exchange failed (err %d)&amp;quot;, err);
	}

	err = bt_conn_set_security(conn, BT_SECURITY_L2);
	if (err) {
		LOG_WRN(&amp;quot;Failed to set security: %d&amp;quot;, err);

		gatt_discover(conn);
	}

	err = bt_scan_stop();
	if ((!err) &amp;amp;&amp;amp; (err != -EALREADY)) {
		LOG_ERR(&amp;quot;Stop LE scan failed (err %d)&amp;quot;, err);
	}
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	char addr[BT_ADDR_LE_STR_LEN];
	int err;

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Disconnected: %s (reason %u)&amp;quot;, addr, reason);

	if (default_conn != conn) {
		return;
	}

	bt_conn_unref(default_conn);
	default_conn = NULL;

	err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
	if (err) {
		LOG_ERR(&amp;quot;Scanning failed to start (err %d)&amp;quot;,
			err);
	}
}

static void security_changed(struct bt_conn *conn, bt_security_t level,
			     enum bt_security_err err)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (!err) {
		LOG_INF(&amp;quot;Security changed: %s level %u&amp;quot;, addr, level);
	} else {
		LOG_WRN(&amp;quot;Security failed: %s level %u err %d&amp;quot;, addr,
			level, err);
	}

	gatt_discover(conn);
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected = connected,
	.disconnected = disconnected,
	.security_changed = security_changed
};

static void scan_filter_match(struct bt_scan_device_info *device_info,
			      struct bt_scan_filter_match *filter_match,
			      bool connectable)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(device_info-&amp;gt;recv_info-&amp;gt;addr, addr, sizeof(addr));

	LOG_INF(&amp;quot;Filters matched. Address: %s connectable: %d&amp;quot;,
		addr, connectable);
}

static void no_match_fun(struct bt_scan_device_info *device_info,
			      struct bt_scan_filter_match *filter_match,
			      bool connectable)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(device_info-&amp;gt;recv_info-&amp;gt;addr, addr, sizeof(addr));

	LOG_INF(&amp;quot;Filters not matched. Address: %s connectable: %d&amp;quot;,
		addr, connectable);
}

static void scan_connecting_error(struct bt_scan_device_info *device_info)
{
	LOG_WRN(&amp;quot;Connecting failed&amp;quot;);
}

static void scan_connecting(struct bt_scan_device_info *device_info,
			    struct bt_conn *conn)
{
	default_conn = bt_conn_ref(conn);
}

static int nus_client_init(void)
{
	int err;
	struct bt_nus_client_init_param init = {
		.cb = {
			.received = ble_data_received,
			.sent = ble_data_sent,
		}
	};

	err = bt_nus_client_init(&amp;amp;nus_client, &amp;amp;init);
	if (err) {
		LOG_ERR(&amp;quot;NUS Client initialization failed (err %d)&amp;quot;, err);
		return err;
	}

	LOG_INF(&amp;quot;NUS Client module initialized&amp;quot;);
	return err;
}

BT_SCAN_CB_INIT(scan_cb, scan_filter_match, no_match_fun,
		scan_connecting_error, scan_connecting);

static int scan_init(void)
{
	int err;
	struct bt_scan_init_param scan_init = {
		.connect_if_match = 0,
	};

	bt_scan_init(&amp;amp;scan_init);
	bt_scan_cb_register(&amp;amp;scan_cb);

	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_UUID, BT_UUID_NUS_SERVICE);
	if (err) {
		LOG_ERR(&amp;quot;Scanning filters cannot be set (err %d)&amp;quot;, err);
		return err;
	}

	err = bt_scan_filter_enable(BT_SCAN_UUID_FILTER, false);
	if (err) {
		LOG_ERR(&amp;quot;Filters cannot be turned on (err %d)&amp;quot;, err);
		return err;
	}

	LOG_INF(&amp;quot;Scan module initialized&amp;quot;);
	return err;
}


static void auth_cancel(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Pairing cancelled: %s&amp;quot;, addr);
}


static void pairing_complete(struct bt_conn *conn, bool bonded)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Pairing completed: %s, bonded: %d&amp;quot;, addr, bonded);
}


static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_WRN(&amp;quot;Pairing failed conn: %s, reason %d&amp;quot;, addr, reason);
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
	.cancel = auth_cancel,
};

static struct bt_conn_auth_info_cb conn_auth_info_callbacks = {
	.pairing_complete = pairing_complete,
	.pairing_failed = pairing_failed
};

void main(void)
{
	int err;

	err = bt_conn_auth_cb_register(&amp;amp;conn_auth_callbacks);
	if (err) {
		LOG_ERR(&amp;quot;Failed to register authorization callbacks.&amp;quot;);
		return;
	}

	err = bt_conn_auth_info_cb_register(&amp;amp;conn_auth_info_callbacks);
	if (err) {
		printk(&amp;quot;Failed to register authorization info callbacks.\n&amp;quot;);
		return;
	}

	err = bt_enable(NULL);
	if (err) {
		LOG_ERR(&amp;quot;Bluetooth init failed (err %d)&amp;quot;, err);
		return;
	}
	LOG_INF(&amp;quot;Bluetooth initialized&amp;quot;);

	if (IS_ENABLED(CONFIG_SETTINGS)) {
		settings_load();
	}

	int (*module_init[])(void) = {uart_init, scan_init, nus_client_init};
	for (size_t i = 0; i &amp;lt; ARRAY_SIZE(module_init); i++) {
		err = (*module_init[i])();
		if (err) {
			return;
		}
	}

	printk(&amp;quot;Starting Bluetooth Central UART example\n&amp;quot;);


	err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
	if (err) {
		LOG_ERR(&amp;quot;Scanning failed to start (err %d)&amp;quot;, err);
		return;
	}

	LOG_INF(&amp;quot;Scanning successfully started&amp;quot;);

	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_client_send(&amp;amp;nus_client, buf-&amp;gt;data, buf-&amp;gt;len);
		if (err) {
			LOG_WRN(&amp;quot;Failed to send data over BLE connection&amp;quot;
				&amp;quot;(err %d)&amp;quot;, err);
		}

		err = k_sem_take(&amp;amp;nus_write_sem, NUS_WRITE_TIMEOUT);
		if (err) {
			LOG_WRN(&amp;quot;NUS send timeout&amp;quot;);
		}
	}
}

void ble_scan_stop_start_thread(void)
{
	int err;
	while(true){

	k_sleep(K_MSEC(5000));

	err = bt_le_scan_stop();
	if (err) {
		LOG_ERR(&amp;quot;Scanning failed to stop (err %d)&amp;quot;, err);
	}
	else{
			LOG_INF(&amp;quot;Scanning stopped&amp;quot;);
	}


	k_sleep(K_MSEC(5000));

	err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
	if (err) {
		LOG_ERR(&amp;quot;Scanning failed to start (err %d)&amp;quot;, err);
	}
	else{
			LOG_INF(&amp;quot;Scanning started&amp;quot;);
	}


	}


}

K_THREAD_DEFINE(ble_scan_stop_start_thread_id, 1024, ble_scan_stop_start_thread, NULL, NULL,
		NULL, 7, 0, 0);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have a thread that is stopping/starting the scanning called&amp;nbsp;ble_scan_stop_start_thread, and&amp;nbsp;I don&amp;#39;t see any hanging&amp;nbsp;when&amp;nbsp;the scanning starts again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/387568?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 18:40:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:493fba9c-f2cb-4b22-82cb-245e46278ee4</guid><dc:creator>Amr Moussa</dc:creator><description>&lt;p&gt;I am still experiencing the same issue on 2.1.0 and the main branch.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/387293?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 12:30:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a29490a2-5b9a-48da-8cbe-c294d6886612</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This should now be fixed. I tested again now with nRF Connect SDK version&amp;nbsp;2.1.0, and I could no longer&amp;nbsp;reproduce the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/382438?ContentTypeID=1</link><pubDate>Fri, 19 Aug 2022 11:17:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd42a958-7f61-4393-b2de-828dd3a1a7bf</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see similar behavior here as well. We are looking into it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/382301?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 13:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23840f4f-b7df-4954-8b65-7471b1299764</guid><dc:creator>Amr Moussa</dc:creator><description>&lt;p&gt;Any updates on this ticket?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/381619?ContentTypeID=1</link><pubDate>Mon, 15 Aug 2022 14:37:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bf905d2-e4cb-404f-b4e1-3ae780660aae</guid><dc:creator>Amr Moussa</dc:creator><description>&lt;p&gt;I have replicated the issue with both version 2.02 and the latest main branch.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth RPC Stack Hangs When Running a Second BLE Scan</title><link>https://devzone.nordicsemi.com/thread/381585?ContentTypeID=1</link><pubDate>Mon, 15 Aug 2022 13:02:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa972b47-9890-4bc4-bfe4-c4b161b7cbe8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not aware of any issues that could cause this. I can try to reproduce it here. What version of nRF Connect SDK are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>