<?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>RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110694/rssi-value-through-the-ble-connection-process-in-nrf-connect-sdk</link><description>Hi Nordic, 
 I am evaluating the nrf52833 DK with nrf connect SDK. I am using by dev kit here as a central devie and I want to get the RSSI values of the periherral devices through the BLE connection process. Here I don&amp;#39;t want to initiate the scanning</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Sep 2025 13:38:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110694/rssi-value-through-the-ble-connection-process-in-nrf-connect-sdk" /><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/547663?ContentTypeID=1</link><pubDate>Wed, 03 Sep 2025 13:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2476448-e63d-4f76-9eb0-f5c0c09fb5f1</guid><dc:creator>jyu10</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Do you know if it is possible to modify the script to just query the individual frequencies that bluetooth LE communicates for RSSI values without having to connect with devices?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/487246?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 08:53:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c51660f-ffc1-4afb-9a03-c660aac7840c</guid><dc:creator>LongQi</dc:creator><description>&lt;p&gt;I still got 127 after I use the work queue unless I add some dealy in &lt;span&gt;check_rssi_and_disconnect() or call&amp;nbsp;check_rssi_and_disconnect() from main loop.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the both situation, printk(&amp;quot;fail getting conn handle&amp;quot;) did not get exectuted.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481497?ContentTypeID=1</link><pubDate>Thu, 02 May 2024 10:51:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:225cfea7-da4a-4773-a57e-431fdb04a1dd</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have modified the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/zephyr/samples/bluetooth/central/README.html"&gt;Zephyr Bluetooth central sample&lt;/a&gt; to print the RSSI found in the connection before disconnecting (it also prints the RSSI for the advertising packet as that is part of the official sample). You just need to add the two Kconigs you have allready included, and&amp;nbsp;use with this .c file:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0245.main.c"&gt;devzone.nordicsemi.com/.../0245.main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481431?ContentTypeID=1</link><pubDate>Thu, 02 May 2024 05:21:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70bbb5bc-ab5a-4bb3-b3b9-c0362f5db2a1</guid><dc:creator>Pranathi CH</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I tried to call it in the main loop as per the thread discussion, but I guess I didn&amp;#39;t get it right and I am confused on what exactly to do, can you explain me clearly how to do it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481296?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2024 13:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca82b07c-7c3a-4fa9-8425-83f0d39a854c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You cannot read the RSSI in the connected callback. You need to wait until it has returned and call it later. See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/110604/rssi-read-through-hci-is-always-reads-as-127"&gt;this thread&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481263?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2024 11:40:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:434cc0df-41e8-47e5-977e-c17603732ca5</guid><dc:creator>Pranathi CH</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I was trying in the meanwhile I added the prj.conf&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_ADVANCED_FEATURES&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_CONN_RSSI&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Now I am getting a constant value of 127 as the RSSI value.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Atleast I am not getting the read error anymore....but am I missing something so I am only getting a 127 constant value every time I run the program?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Pranathi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481253?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2024 10:47:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e952c5e5-bdfb-46fe-b466-0327b3c46db9</guid><dc:creator>Pranathi CH</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I am explicitely able to connect to the BLE device with my Dev kit without scanning. And to read RSSI, I have added the function read_conn_rssi() in my code and called it.&lt;/p&gt;
&lt;p&gt;I am getting the Read RSSI error as -5, which is internally mentioned as I/O error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;CODE:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void read_conn_rssi(uint16_t handle, int8_t *rssi)
{
	struct net_buf *buf, *rsp = NULL;
	struct bt_hci_cp_read_rssi *cp;
	struct bt_hci_rp_read_rssi *rp;

	int err;

	buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp));
	if (!buf) {
		printk(&amp;quot;Unable to allocate command buffer\n&amp;quot;);
		return;
	}

	cp = net_buf_add(buf, sizeof(*cp));
	cp-&amp;gt;handle = sys_cpu_to_le16(handle);

	err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_RSSI, buf, &amp;amp;rsp);
	if (err) {
		uint8_t reason = rsp ?
			((struct bt_hci_rp_read_rssi *)rsp-&amp;gt;data)-&amp;gt;status : 0;
		printk(&amp;quot;Read RSSI err: %d reason 0x%02x\n&amp;quot;, err, reason);
		return;
	}

	rp = (void *)rsp-&amp;gt;data;
	*rssi = rp-&amp;gt;rssi;

	net_buf_unref(rsp);
}

static void connected(struct bt_conn *conn, uint8_t err)
{
    char addr[BT_ADDR_LE_STR_LEN];

	
     
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

    if (err) {
        printk(&amp;quot;Failed to connect to %s (%u)\n&amp;quot;, addr, err);

        bt_conn_unref(default_conn);
        default_conn = NULL;
	}
	else
	{

	}

    if (conn != default_conn) {
        return;
    }
    printk(&amp;quot;\nConnected: %s\n&amp;quot;, addr);
	int8_t rssi = 0xFF;
	// printk(&amp;quot;\nRSSI:%d\n&amp;quot;,rssi);
	read_conn_rssi(default_conn_handle, &amp;amp;rssi);
	printk(&amp;quot;Connected (%d) - RSSI = %d\n&amp;quot;,default_conn_handle, rssi);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;OUTPUT:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-2024_2D00_04_2D00_30-161433.png" /&gt;&lt;/p&gt;
&lt;p&gt;How do I solve it?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Pranathi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RSSI value through the BLE connection process in nRF connect SDK</title><link>https://devzone.nordicsemi.com/thread/481062?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2024 11:48:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddd1a916-e8ca-49d8-b42a-1ecc690047d5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Pranathi,&lt;/p&gt;
&lt;p&gt;To be clear, there is no way to connect without scanning. When you excplicitly attemt to connect to a specific BLE address, what happens is that scanning is started, and when you receive a connectable advertising packet from the specified address, the BLE stack will connect to it.&lt;/p&gt;
&lt;p&gt;With that out of the way, to obtain the RSSI in a connection you can use&amp;nbsp;BT_HCI_OP_READ_RSSI. You can find an example of that in&amp;nbsp;read_conn_rssi() in&amp;nbsp;zephyr/samples/bluetooth/hci_pwr_ctrl/src/main.c.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>