This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Scanning with filtering

Hi everybody.

Now I trying to make BLE central device.

I'm using nrf52832.

SDK : 17.0.2

SoftDevice :S132 7.2.0

(I'm completely new at nrf52 product.)

In case of app_uart_c example, scanning is filtered by UUID to find peripheral device that example program written(ble_app_uart).

So now I'm trying to filtering by name.

Specifically...

I added

static char const m_target_periph_name[] = "Nordic_UART";

and instead of filtering by UUID, added in scan_init() function.

/*
// Setting filters for scanning.(By UUID)
err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_nus_uuid);
APP_ERROR_CHECK(err_code);

err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, false);
APP_ERROR_CHECK(err_code);
*/

// Setting filters for scanning.(By Name)

err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, m_target_periph_name);
APP_ERROR_CHECK(err_code);

err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_NAME_FILTER, false);
APP_ERROR_CHECK(err_code);

( I referred this post of the forum.

https://devzone.nordicsemi.com/f/nordic-q-a/40686/where-to-change-name-for-the-scanning-peripheral-name-in-the-uart-central-code/158193#158193)

When I run the debugger, it break at NRF_BREAKPOIN_COND in app_error_weak.c.

then I continue, it keep at same line.

On the Debug Terminal, "app: Fatal error" is displayed.

I checked which line is causing this problem by debugger.

Then I found that it is jump to NRF_BREAKPOIN_COND after "APP_ERROR_CHECK()" of "nrf_ble_scan_filter_set()".

When I tried this example project without modification, It was working correctly.

then the Debug Terminal,"app: BLE UART central example started" was displayed.

Anybody can teach me why this problem is happening?

How can I solve it?

Thank you.

Parents
  • Hi, Einar.

    Thank you for your reply.
    Your indication is effective.

    As you said, when I have this error, "NRF_BLE_SCAN_NAME_CNT" was set to 0 in my sdk_config.h.
    By changing this macro 0 to 1, now example program that I changed filter part is working correctly.
    Scanning with filter by name is working.

    Also, thank you for your advise about Debug Build.
    by changing Build Configuration from "Release" to "Build", detailed information about error is displayed in Debug Console when having error.
    Currently I'm in testing stage so this is good for me.

    Thank you very much!

Reply
  • Hi, Einar.

    Thank you for your reply.
    Your indication is effective.

    As you said, when I have this error, "NRF_BLE_SCAN_NAME_CNT" was set to 0 in my sdk_config.h.
    By changing this macro 0 to 1, now example program that I changed filter part is working correctly.
    Scanning with filter by name is working.

    Also, thank you for your advise about Debug Build.
    by changing Build Configuration from "Release" to "Build", detailed information about error is displayed in Debug Console when having error.
    Currently I'm in testing stage so this is good for me.

    Thank you very much!

Children
No Data
Related