<?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 scan filter by device name</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79991/ble-scan-filter-by-device-name</link><description>Hello there, 
 It is actually basic for the Bluetooth connection for the nrf52840 using Zephyr, which changed the scan filter by name based on the central UART sample. 
 As the peripheral device name is assigned &amp;quot;FF_22&amp;quot;, and I used the nRF Connect app</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Oct 2021 14:58:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79991/ble-scan-filter-by-device-name" /><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/332878?ContentTypeID=1</link><pubDate>Wed, 06 Oct 2021 14:58:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f2ed129-0e00-4052-8f22-fc36b6c3723e</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, Ethan&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;/p&gt;
[quote user="EthanH"]Secondly, I removed the error return like this:[/quote]
&lt;p&gt;I can not recommend that you remove the checks for returned error codes - if you do not check your error codes you will have no way of knowing if a function has unexpectedly failed, or if the program may proceed as usual.&lt;br /&gt;This is only masking the symptoms of the failure, instead of fixing the root cause.&lt;br /&gt;&lt;br /&gt;I tried scanning for two different device names using the following scan init and CONFIG_BT_SCAN_NAME_CNT=2&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static int scan_init(void)
{
	int err;
	struct bt_scan_init_param scan_init = {
		.connect_if_match = 1,
	};

	bt_scan_init(&amp;amp;scan_init);
	bt_scan_cb_register(&amp;amp;scan_cb);

	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, DEVICE_NAME_FIRST);
	if (err) {
		LOG_ERR(&amp;quot;Scanning filters cannot be set (err %d)&amp;quot;, err);
		return err;
	}
	
	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, DEVICE_NAME_SECOND);
	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_NAME_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;
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And it worked just as expected for me - both DEVICE_NAME_FIRST and DEVICE_NAME_SECOND triggers a scan filter match.&lt;br /&gt;This is the only change I&amp;#39;ve made to the central uart sample. To rule out the scan initialization and usage being an issue could you try to make these changes to an unmodified version of the central uart application, and see if you get a filter match on both the different device names?&lt;br /&gt;&lt;br /&gt;I do not see the Scan module initialized - started messages in the initial log you share. This makes me suspect that the application never gets as far as scanning starting.&lt;br /&gt;Could you try to debug the application and see if it gets stuck somewhere prior to this? I would expect the same scan messages to appear in the log.&lt;br /&gt;If not, there might be a problem earlier in your application, such as with the usb_cdc_acm which is generating warnings and suspending the device.&lt;br /&gt;If you are able to properly deploy both name filters on the unmodified central uart example we should look at resolving the usb_cdc_acm warnings first of all, before we proceed with the perceived scanning issue.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331924?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 12:25:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4b25fcb-9d60-46f3-b57d-6c7049aabc2c</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;Thank you for info.&lt;/p&gt;
&lt;p&gt;Firstly, I gave the error coding to return the results from&amp;nbsp;bt_scan_filter_add(), but no work for both.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name1);
        if (err){
		printk(&amp;quot;Filter1 cannot be set (err %d)&amp;quot;, err);
		return err;
	}
	
    err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name2);
	if (err){
		printk(&amp;quot;Filter2 cannot be set (err %d)&amp;quot;, err);
		return err;
	}
	
	err = bt_scan_filter_enable(BT_SCAN_NAME_FILTER, false);
    if (err){
        printk(&amp;quot;Filters cannot be turned on (err %d)&amp;quot;, err);
        return err;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Log info:&lt;/p&gt;
&lt;p&gt;&lt;img height="137" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1633004289338v1.png" width="438" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Secondly, I removed the error return like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name1);

err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name2);

err = bt_scan_filter_enable(BT_SCAN_NAME_FILTER, false);
if (err){
    printk(&amp;quot;Filters cannot be turned on (err %d)&amp;quot;, err);
    return err;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Log info for the first success connection:&lt;/p&gt;
&lt;p&gt;&lt;img height="267" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1633004457217v2.png" width="361" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;While the second one was not connected, log info:&lt;/p&gt;
&lt;p&gt;&lt;img height="150" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1633004506121v3.png" width="361" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;From my understanding, it is probably relevant to the filter by name addition function as the system can recognize the first one which means the BLE connection configure is OK.&lt;/p&gt;
&lt;p&gt;And the system still consider the first name as the filter so that I think the&amp;nbsp;way for adding the name filter is wrong for me.&lt;/p&gt;
&lt;p&gt;Please check it and share your idea.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331915?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 12:00:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6ebb068-1b50-4bf2-a4df-4ac7720d36ac</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="EthanH"]I gave the code here:[/quote]
&lt;p&gt;Please make sure to check the returned error codes from the bt_scan_filter_add functions as well - I assume you already do so, and that this snippet is just to illustrate, but I mention it just in case.&lt;br /&gt;Could you confirm that both these calls, and the call to bt_scan_filter_enable, returns successfully?&lt;/p&gt;
[quote user="EthanH"]And here is the log info:[/quote]
&lt;p&gt;Could you show me the entire log for the sequence in which you successfully filter match on the first device name, and then unsuccessfully on the second?&lt;br /&gt;It looks to me like the issue in the log is that the device fails to send data over the BLE connection - even though there is no mention of a connection being established. Error 128 means that there is no valid connection.&lt;br /&gt;Could it be that you are attempting to call ble_nus_data_send or similar, without first having confirmed whether you are currently in a connection or not?&lt;/p&gt;
[quote user="EthanH"]In addition,&amp;nbsp;I just use the earphone to illustrate my intention, so my case is to BLE connect the two peripheral device and to receive the data from both. It help understand my project here in the overall design.[/quote]
&lt;p&gt;Aha, thank you for clarifying, this helps me understand your use case better. I just though I should mention the LE Audio feature since it will be such a huge improvement on audio streaming over BLE.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331898?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 11:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3708edff-8b2c-46a6-8268-c2a6c77fc579</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Following your suggestion &amp;quot;&lt;span&gt;Please try to separate the two into two calls to bt_scan_filter_add and see if this makes both devices trigger a filter match.&lt;/span&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;I gave the code here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;char device_name1[5]=&amp;quot;FF_02&amp;quot;;
char device_name2[5]=&amp;quot;FF_09&amp;quot;;
char *name1 = device_name1;
char *name2 = device_name2;

...
err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name1);
err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name2);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is actually same as the pervious that&amp;nbsp; it only filter and connect the first one, while no wok for the second.&lt;/p&gt;
&lt;p&gt;And here is the log info:&lt;/p&gt;
&lt;p&gt;&lt;img height="194" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1633000764418v1.png" width="467" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Can you please share your code based on this design?&lt;/p&gt;
&lt;p&gt;In addition,&amp;nbsp;I just use the earphone to illustrate my intention, so my case is to BLE connect the two peripheral device and to receive the data from both. It help understand my project here in the overall design.&lt;/p&gt;
&lt;p&gt;Thanks always&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331879?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 10:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0707e71-abb7-4ad7-82da-f7e4a11c2b21</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, Ethan&lt;/p&gt;
[quote user="EthanH"]Thanks always for your help![/quote][quote user="EthanH"]Appreciate for your kindly help.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="EthanH"]It works for the single filter by name, as you suggested.[/quote]
&lt;p&gt;Great! I am glad to hear that it now works for filtering of a single device name, we can then move on to adding the filter for the over device.&lt;/p&gt;
[quote user="EthanH"]Now I just have the additional issue regarding the two peripheral device connection. &lt;br /&gt;If I need to filter and connect two device by the name, e.g. FF_01 and FF_02, I gave my understanding as below.[/quote]
&lt;p&gt;It seems that the bt_scan_filter_add function only reads the first c string of the provided buffer, so you can not provide both names in the same call. Please try to separate the two into two calls to bt_scan_filter_add and see if this makes both devices trigger a filter match.&lt;/p&gt;
[quote user="EthanH"]In addition, my final objective is to connect the two devices by the name filter at the same time, transmitting the data directly like the BLE earphone left and right.[/quote]
&lt;p&gt;Are you intending to create an left and right earphone, or are you just using this as an example to illustrate your intentions?&lt;br /&gt;If you are, have you read anything about the coming &lt;a href="https://www.nordicsemi.com/Products/Bluetooth-LE-Audio"&gt;LE Audio feature&lt;/a&gt;?&lt;br /&gt;We will soon make our LE Audio software support publicly available, so perhaps this could be interesting for you to have a look at if you are still in the process of evaluating different solutions.&lt;br /&gt;If you would like to hear more about LE Audio, or discuss the roadmap / future releases, I would have to ask that you reach out to your Regional Sales Manager (RSM) with these questions since we do not discuss future releases here on DevZone. If you do not know who your RSM is, please send me a direct message with your location, so I may provide you with their contact information.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331842?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 07:29:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6f74e18-42de-4fd4-9500-3b1d071e7484</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Appreciate for your kindly help. It works for the single filter by name, as you suggested.&lt;/p&gt;
&lt;p&gt;Now I just have the additional issue regarding the two peripheral device connection. &lt;br /&gt;If I need to filter and connect two device by the name, e.g. FF_01 and FF_02, I gave my understanding as below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;char device_name[2][5]={&amp;quot;FF_01&amp;quot;,&amp;quot;FF_02&amp;quot;};

char *name = device_name;

....

err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Meanwhile I changed the&amp;nbsp;CONFIG_BT_SCAN_NAME_CNT=2 in the prj.conf.&lt;/p&gt;
&lt;p&gt;The current result is it can filter and connect the first one (FF_01), when I only powered the FF_01.&lt;/p&gt;
&lt;p&gt;While it can&amp;#39;t filter and connect the second one (FF_02), when I powered the FF_02 and powered off the FF_01.&lt;/p&gt;
&lt;p&gt;Can you please check which stage is wrong or missing?&lt;/p&gt;
&lt;p&gt;In addition, my final objective is to connect the two devices by the name filter at the same time, transmitting the data directly like the BLE earphone left and right.&lt;/p&gt;
&lt;p&gt;But I should move on step by step to figure out two filter and connection firstly.&lt;/p&gt;
&lt;p&gt;Thanks always for your help!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331758?ContentTypeID=1</link><pubDate>Wed, 29 Sep 2021 14:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0024c3d-7533-4238-bd79-0365484c3ac1</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again, Ethan&lt;br /&gt;&lt;br /&gt;I do not immediately see anything wrong with your prj.conf either, unfortunately - it looks alright to me.&lt;br /&gt;I went ahead and tried this on my end - starting with the BLE UART central example, and modifying it with the code lines from my previous comment, with a prj.conf similar to yours (with CONFIG_BT_SCAN_NAME_CNT=1), and it works immediately.&lt;br /&gt;Looking into the source code of the scanning library I see that it is the count for the name filter that is triggering the ENOMEM error. Could you try to increase the&amp;nbsp;CONFIG_BT_SCAN_NAME_CNT = 2, and see if this error persists?&lt;br /&gt;I ask because I suspect that the name filter might have been set already somewhere else in your code.&lt;br /&gt;Could it be that you have already attempted to implement the &amp;#39;filter for two different names&amp;#39; you mention in your later comment, and that this is thus exceeding the&amp;nbsp;CONFIG_BT_SCAN_NAME_CNT=1 configuration?&lt;br /&gt;&lt;br /&gt;If this does not resolve your issue, could you share your entire main.c file with me, so I may take a look?&lt;/p&gt;
[quote user="EthanH"]&lt;p&gt;I still have the question about the filter by two different names, can we achieve that?&lt;/p&gt;
&lt;p&gt;As writing in your code, if I give two names (nordic1 and nordic2) are both required to be scanned by name filter, what should I do for the command of bt_scan_filter_add?&lt;/p&gt;[/quote]
&lt;p&gt;Do I understand you correctly that you would like to scan for two different names, and be alerted if either of them is found?&lt;br /&gt;If so, you will need to set&amp;nbsp;CONFIG_BT_SCAN_NAME_CNT=2, and add and enable the two different name filters like I showed in my previous comment.&lt;br /&gt;If the scanning module is using the Normal filter mode it will trigger a filter match if any one of the enabled filters are met - unlike multifilter mode, which requires a combination of filters to be met.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331572?ContentTypeID=1</link><pubDate>Tue, 28 Sep 2021 16:29:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe02faef-00b5-4870-b9d0-e5a903f4034e</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I still have the question about the filter by two different names, can we achieve that?&lt;/p&gt;
&lt;p&gt;As writing in your code, if I give two names (nordic1 and nordic2) are both required to be scanned by name filter, what should I do for the command of bt_scan_filter_add?&lt;/p&gt;
&lt;p&gt;Here is my trial, while the program seems to be stuck and cannot continue。&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define DEVICE_NAME1 &amp;quot;nordic1&amp;quot;
#define DEVICE_NAME2 &amp;quot;nordic2&amp;quot;

...
    err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, DEVICE_NAME1);
	if (err){
		printk(&amp;quot;Filter1 cannot be set (err %d)&amp;quot;, err);
		return err;
	}
	
    err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, DEVICE_NAME1);
        if (err){
		printk(&amp;quot;Filter2 cannot be set (err %d)&amp;quot;, err);
		return err;
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks again and please share your suggestion here.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331365?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 15:01:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14609a32-722e-44a3-bb64-edd578c0050e</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;Thank you for the help and info firstly.&lt;/p&gt;
&lt;p&gt;Here is my prj.conf file:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver
# CONFIG_NRFX_UARTE0=y
# CONFIG_SERIAL=y
# CONFIG_CONSOLE=y
# CONFIG_UART_CONSOLE=y

CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT=&amp;quot;FF&amp;quot;
CONFIG_USB_UART_CONSOLE=y

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_CONSOLE_ON_DEV_NAME=&amp;quot;CDC_ACM_0&amp;quot;

# Enable the BLE stack with GATT Client configuration
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y

# Enable the BLE modules from NCS
CONFIG_BT_NUS_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
CONFIG_BT_SCAN_NAME_CNT=1
CONFIG_BT_GATT_DM=y
CONFIG_HEAP_MEM_POOL_SIZE=2048

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_BT_DEBUG_ATT=y

CONFIG_ASSERT=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please check it, I think the&amp;nbsp;issue mainly is relevant to the configuration as you were saying.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331358?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 14:36:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de196586-8759-4978-b354-6df2b5103096</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Ethan,&lt;/p&gt;
[quote user="EthanH"]Thanks for your help.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="EthanH"]I know it is a pointer to the data type.[/quote][quote user="EthanH"]You can check the answer by Einar that he directly used the device name here &amp;quot;nRF Connect&amp;quot;.[/quote]
&lt;p&gt;I did not mean to imply that you did not, I thought it had to be passed the output of a macro or specific struct, like in the case of UUID&amp;#39;s for instance, my mistake.&lt;br /&gt;It does indeed seem like it should just accept the name as a string when filtering on name.&lt;br /&gt;This should indeed work, and so then should your original code:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define DEVICE_NAME &amp;quot;nordic&amp;quot;

..
	bt_scan_init(&amp;amp;scan_init);
	bt_scan_cb_register(&amp;amp;scan_cb);

	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, DEVICE_NAME);
	if (err){
		printk(&amp;quot;Filters cannot be set (err %d)&amp;quot;, err);
		return err;
	}

	err = bt_scan_filter_enable(BT_SCAN_NAME_FILTER, false);
    if (err){
        printk(&amp;quot;Filters cannot be turned on (err %d)&amp;quot;, err);
        return err;
    }
..&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Could you show me your entire project config? The error you are getting -&amp;nbsp;&lt;span&gt;Error 12 - means&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/errno_8h_a6a05c923dad0c1208043e9c20a58c8e5.html#a6a05c923dad0c1208043e9c20a58c8e5"&gt;ENOMEM&lt;/a&gt;, so perhaps the issue here instead lays with the project configuration, even though it looks alright since you have already set&amp;nbsp;CONFIG_BT_SCAN_NAME_CNT = 1.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331283?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 10:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ab85829-25df-430f-9f93-8379f9d2f196</guid><dc:creator>EthanH</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;br /&gt;I know it is a pointer to the data type.&lt;br /&gt;While I just use BT_SCAN_FILTER_TYPE_NAME not short name.&lt;br /&gt;You can check the answer by Einar that he directly used the device name here &amp;quot;nRF Connect&amp;quot;.&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/62413/combined-scan-filtering"&gt;devzone.nordicsemi.com/.../combined-scan-filtering&lt;/a&gt;&lt;br /&gt;At the same time, I defined the device name like here:&lt;pre class="ui-code" data-mode="c_cpp"&gt;char device_name[]=&amp;quot;FF_11&amp;quot;;
char *name = device_name;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, name);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Still not working.&lt;/p&gt;
&lt;p&gt;Thanks again for your help, if you can share the idea.&lt;br /&gt;BR,&lt;br /&gt;Ethan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE scan filter by device name</title><link>https://devzone.nordicsemi.com/thread/331214?ContentTypeID=1</link><pubDate>Mon, 27 Sep 2021 07:25:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8165f52b-3384-4a3b-b861-cb0bfdd38423</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;The &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/bluetooth_services/scan.html?highlight=bt_scan_filter_add#c.bt_scan_filter_add"&gt;bt_scan_filter_add function&lt;/a&gt; expects a pointer to a specific data type, such as &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/bluetooth_services/scan.html?highlight=bt_scan_short_name#c.bt_scan_short_name"&gt;bt_scan_short_name&lt;/a&gt;&amp;nbsp;or similar,&amp;nbsp;to be provided.&lt;br /&gt;Please see this answer by my colleague &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50729/how-to-bt_scan_filter_add-by-short-name"&gt;Hellesvik&lt;/a&gt;&amp;nbsp;for more information.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>