<?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 Central and Mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106067/ble-central-and-mesh</link><description>Hi, I want to implement a system in which a thingy:53 will scan for beacons, gets their RSSI value and publishes them to a mesh network using custom models. 
 Then I want to use a RPi 4B to get these values and publish them to a cloud. Can anyone guide</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Dec 2023 15:53:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106067/ble-central-and-mesh" /><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/460418?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2023 15:53:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a6bbef-52be-440e-91f2-b97289d59b69</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Allright,&lt;/p&gt;
&lt;p&gt;Thank you for letting me know&lt;/p&gt;
&lt;p&gt;I will close this case for now, please feel free to open it if there are any other questions related to this case you need an answer to&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/460199?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 16:50:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb46ad1d-c9bc-4447-b80f-e51990087b84</guid><dc:creator>Jeason</dc:creator><description>&lt;p&gt;Sorry for the late reply. This is great. Thank you.&lt;br /&gt;&lt;br /&gt;However we decided to move away from the BLE beacons and decided to create mesh beacons from nRF52832 boards. I created a vendor model client and server. so now the beacon is on the mesh network instead a being a BLE device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458970?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 13:12:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b53f739-dabb-431b-95c1-2fcd11275f28</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve discussed this with the Mesh team.&lt;/p&gt;
&lt;p&gt;First of, the stop scan is necessary as you can&amp;#39;t start another scanning since the Mesh stack already has one ongoing. This is the reason for why you need to stop it using bt_scan_stop().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The second thing is that we have another option for you. Rather than configuring the device as a Mesh + BLE central, you can register another callback using&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;code&gt;bt_le_scan_cb_register&lt;/code&gt; and read the RSSI value from the&amp;nbsp;&lt;code&gt;struct bt_le_scan_recv_info&lt;/code&gt; structure.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In addition using acceptance filters you will create conflicts in the Mesh&lt;/p&gt;
&lt;p&gt;So in other words, unless you specifically need BLE Central features, this other option is what we recommend&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458134?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2023 14:24:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53c56ba6-d879-45a6-963d-18da90af710a</guid><dc:creator>Jeason</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void update_scan_filter(void)
{
&amp;#160; &amp;#160; int err;

&amp;#160; &amp;#160; err = bt_le_filter_accept_list_clear();
&amp;#160; &amp;#160; if (err) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Clear filter on device address error: %d\n&amp;quot;, err);
&amp;#160; &amp;#160; }
&amp;#160; &amp;#160; static bt_addr_le_t m_dev_address_tag1 =
&amp;#160; &amp;#160; {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; .type &amp;#160; = BT_ADDR_LE_PUBLIC,
&amp;#160; &amp;#160; };
&amp;#160; &amp;#160; memcpy(m_dev_address_tag1.a.val, tag1ID, BT_ADDR_SIZE);

&amp;#160; &amp;#160; err = bt_le_filter_accept_list_add(&amp;amp;m_dev_address_tag1);
&amp;#160; &amp;#160; if (err) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Set filter on device address error: %d\n&amp;quot;, err);
&amp;#160; &amp;#160; }



}





static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;struct net_buf_simple *ad)
{
&amp;#160; &amp;#160; char addr_str[BT_ADDR_LE_STR_LEN];
&amp;#160; &amp;#160; if (type != BT_GAP_ADV_TYPE_ADV_IND &amp;amp;&amp;amp;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; type != BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
&amp;#160; &amp;#160; printk(&amp;quot;Device found: %s (RSSI %d)\n&amp;quot;, addr_str, rssi);
&amp;#160; &amp;#160; Rssi = rssi;
&amp;#160; &amp;#160; bt_le_scan_stop();
}

static void start_scan(void)
{
&amp;#160; &amp;#160; int err;

&amp;#160; &amp;#160; bt_le_scan_stop();
&amp;#160; &amp;#160; update_scan_filter();

&amp;#160; &amp;#160; struct bt_le_scan_param param ={
&amp;#160; &amp;#160; &amp;#160; &amp;#160; .type = BT_LE_SCAN_TYPE_PASSIVE,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; .options = BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; .interval = BT_GAP_SCAN_FAST_INTERVAL,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; .window = BT_GAP_SCAN_FAST_WINDOW,
&amp;#160; &amp;#160; };
&amp;#160; &amp;#160; err = bt_le_scan_start(&amp;amp;param, device_found);
&amp;#160; &amp;#160; if (err) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Scanning failed to start (err %d)\n&amp;quot;, err);
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; printk(&amp;quot;Scanning successfully started\n&amp;quot;);
}

int AmbientTemperatureGet(struct bt_mesh_sensor_srv *srv,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;struct bt_mesh_sensor *sensor,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;struct bt_mesh_msg_ctx *ctx,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;struct sensor_value *rsp)
{


&amp;#160; &amp;#160; start_scan();
&amp;#160; &amp;#160;
&amp;#160; &amp;#160; rsp-&amp;gt;val1 = Rssi;
&amp;#160; &amp;#160; rsp-&amp;gt;val2 = 0;
&amp;#160; &amp;#160; return 0;
&amp;#160; &amp;#160;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458116?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2023 13:49:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7294335-339a-4705-8e23-9e1f30a19cf7</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
[quote user="Jeason"]In my application I have enabled mesh and observer role in the prj.conf file. I don&amp;#39;t really know what else to configure in my application to concurrently use both protocols at the same time.[/quote]
&lt;p&gt;If you haven&amp;#39;t done so already, you could have a look at&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/mesh/ble_peripheral_lbs_coex/README.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/mesh/ble_peripheral_lbs_coex/README.html&lt;/a&gt;&amp;nbsp;and modify this so it acts as a central instead of a peripheral and test if that works or to validate that you&amp;#39;ve configured everything correct by examining that sample.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m waiting for a reply from the developers regarding if it is possible to modify the peripheral coexistence sample to be a central instead, but I suspect there are some considerations that you need to make. One item is that you may get some degradation of the Mesh network as the device needs to act as a BLE Central and scan for the nodes instead of listening to the Mesh network as a mesh device. But with moderate&lt;/p&gt;
&lt;p&gt;BLE activity I believe this should be possible.&amp;nbsp;&lt;/p&gt;
[quote user="Jeason"]But this also gave me the same error. However if I give a bt_le_scan_stop() command before I initiate my scan it does not give me an error and I am getting my reading on the nrF mesh iOS app.[/quote]
&lt;p&gt;Could you post the section of the code for the case where you have a successful scan?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458075?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2023 12:01:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2148ab51-757a-4cbb-a25f-207d09d18a02</guid><dc:creator>Jeason</dc:creator><description>&lt;p&gt;In my application I have enabled mesh and observer role in the prj.conf file. I don&amp;#39;t really know what else to configure in my application to concurrently use both protocols at the same time.&lt;/p&gt;
&lt;p&gt;Since I did not know if my custom model has having the issue I was using the sensor model and instead of getting the sensor value, I initiate a BLE scan, gets RSSI of one beacons and pass that to rsp-&amp;gt;val1.&lt;br /&gt;&lt;br /&gt;But this also gave me the same error. However if I give a bt_le_scan_stop() command before I initiate my scan it does not give me an error and I am getting my reading on the nrF mesh iOS app.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Use deferred logging
CONFIG_NCS_SAMPLES_DEFAULTS=n
CONFIG_LOG=y
CONFIG_ASSERT=y
CONFIG_ASSERT_NO_COND_INFO=y
CONFIG_ASSERT_NO_MSG_INFO=y

# General configuration
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_NVS_LOOKUP_CACHE=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS_NAME_CACHE=y
CONFIG_HWINFO=y
CONFIG_DK_LIBRARY=y
CONFIG_PM_SINGLE_IMAGE=y
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE=y

# Temperature sensor
CONFIG_SENSOR=y
CONFIG_BME680=y

# Bluetooth configuration
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_COMPANY_ID=0x0059
CONFIG_BT_DEVICE_NAME=&amp;quot;Mesh Sensor&amp;quot;
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
CONFIG_BT_BUF_ACL_TX_SIZE=37
CONFIG_BT_OBSERVER=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SETTINGS=y
CONFIG_BT_SCAN=y
CONFIG_BT_FILTER_ACCEPT_LIST=y

# Disable unused Bluetooth features
CONFIG_BT_PHY_UPDATE=n

# Bluetooth mesh configuration
CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_MESH_FRIEND=y
CONFIG_BT_MESH_ADV_BUF_COUNT=13
CONFIG_BT_MESH_TX_SEG_MAX=10
CONFIG_BT_MESH_PB_GATT=y
CONFIG_BT_MESH_GATT_PROXY=y
CONFIG_BT_MESH_PROXY_USE_DEVICE_NAME=y
CONFIG_BT_MESH_DK_PROV=y
CONFIG_BT_MESH_SUBNET_COUNT=2
CONFIG_BT_MESH_APP_KEY_COUNT=3
CONFIG_BT_MESH_CRPL=32
CONFIG_BT_MESH_MSG_CACHE_SIZE=64

# Bluetooth mesh models
CONFIG_BT_MESH_SENSOR_SRV=y
CONFIG_BT_MESH_ONOFF_SRV=y
CONFIG_BT_MESH_SENSOR_SRV_SENSORS_MAX=5
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458069?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2023 11:50:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bc6a2f2-25f2-4382-becc-0b24c513f2df</guid><dc:creator>AHaug</dc:creator><description>[quote user="Jeason"]As far as I know the thingy has a nRF5340 chip and it supports both Mesh and BLE concurrently.[/quote]
&lt;p&gt;Yes, that is correct. I should&amp;#39;ve been more specific. What I meant is if your application supports both protocols concurrently&lt;/p&gt;
&lt;p&gt;Thank you for clarifying. I will dig around some and see if I can find an answer to your questions&lt;/p&gt;
&lt;p&gt;I will get back to you when I know some more&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/458041?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2023 10:37:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b64099e-1398-44d4-8d8c-0094e4803e37</guid><dc:creator>Jeason</dc:creator><description>&lt;p&gt;As far as I know the thingy has a nRF5340 chip and it supports both Mesh and BLE concurrently.&lt;br /&gt;&lt;br /&gt;The model has a get function which gets rssi values by performing a passive scan with an accept list to filter unwanted advertisements. But when it runs I get a&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;Socket already connected&amp;quot; error from bt_le_start_scan() command.&lt;/p&gt;
&lt;p&gt;However the get function works perfectly when i move it a an application which only does BLE.&lt;/p&gt;
&lt;p&gt;My understanding is that when it comes to a mesh, it has an in built functions which already scan for other mesh devices and is preventing me from making an another scan. Is there a way around this?&lt;/p&gt;
&lt;div data-code="id#34"&gt;
&lt;div class="monaco-tokenized-source"&gt;&lt;span class="mtk7"&gt;Do&amp;nbsp;we have a guide for concurrent mesh and central application?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/457652?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 16:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b67fb5-aca5-4028-b097-50176a6526c6</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Aha, if so then I will have to look&amp;nbsp;some more into this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you tell me some more about your central/Thingy:53? Does this support both Bluetooth Mesh and BLE?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How far into the procedure do you get? Are you able to pick up the RSSI values? Does the socket error occur when you attempt to get the RSSI values or after/when publishing it on the mesh model?&lt;/p&gt;
&lt;p&gt;Could you post the device log showing the error you&amp;#39;re getting?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/457651?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 16:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd7baf17-d882-47b2-acb4-ed18e9eb1e2b</guid><dc:creator>Jeason</dc:creator><description>&lt;p&gt;Thanks for the reply Andreas.&lt;br /&gt;&lt;br /&gt;The thing is, the beacon I am using is not a mesh compatible device. It is a Minew B7 tag which has a n52810 chip.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I created a custom model for RSSI in thingy:53, but when I try to get rssi values by scanning for ble devices, it gives me a Socket already connected error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central and Mesh</title><link>https://devzone.nordicsemi.com/thread/457645?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 16:01:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e631c785-4cb5-4150-914f-22390a3ef137</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In Mesh,&amp;nbsp;&lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/v2.1.1/subsys/bluetooth/mesh/gen_onoff_srv.c#l106" href="https://github.com/nrfconnect/sdk-nrf/blob/v2.1.1/subsys/bluetooth/mesh/gen_onoff_srv.c#L106" rel="noopener noreferrer" target="_blank"&gt;All messages&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;delivered to the model handlers carries the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a title="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/include/zephyr/bluetooth/mesh/msg.h#l92" href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.1.99-ncs1/include/zephyr/bluetooth/mesh/msg.h#L92" rel="noopener noreferrer" target="_blank"&gt;RSSI&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;information in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;bt_mesh_msg_ctx&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;passed to the handler. You can inspect &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/mesh/msg.html#c.bt_mesh_msg_ctx"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/mesh/msg.html#c.bt_mesh_msg_ctx &lt;/a&gt;for more details.&lt;/p&gt;
&lt;p&gt;Using this information together with our&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bt_mesh_vendor_model.html"&gt;guide for creating custom models&lt;/a&gt;&amp;nbsp;you can write your own model similar to the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_models_vendor_rssi_monitor_README.html"&gt;RSSI model from nRF5 SDK&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regarding how to get this up on a cloud you will have to think about what cloud you&amp;#39;re aiming to use and what communication you aim to use. Unless you will be using nRF Cloud, we have limited resources available for how to do this, but you might find some inspiration or other developers who have done so on the Zephyr discord forum. See the community tab at&amp;nbsp;&lt;a href="https://www.zephyrproject.org/"&gt;https://www.zephyrproject.org/#&lt;/a&gt;&amp;nbsp;for a link to the discord&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701100876123v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>