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,

    The error here is probably that NRF_BLE_SCAN_NAME_CNT is set to 0 in sdk_config.h, so you need to adjust it to 1.

    Also, I recommend you use a debug build when testing (by selecting Debug from the build configuration dropdown if using SES, or defining DEBUG and DEBUG_NRF if using another toolchain), as that will give you a more sensible error report:

    <error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM] at C:\Users\eith\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_uart_c\main.c:194
    PC at: 0x00030447
    <error> app: End of error report

    Einar

Reply
  • Hi,

    The error here is probably that NRF_BLE_SCAN_NAME_CNT is set to 0 in sdk_config.h, so you need to adjust it to 1.

    Also, I recommend you use a debug build when testing (by selecting Debug from the build configuration dropdown if using SES, or defining DEBUG and DEBUG_NRF if using another toolchain), as that will give you a more sensible error report:

    <error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM] at C:\Users\eith\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_uart_c\main.c:194
    PC at: 0x00030447
    <error> app: End of error report

    Einar

Children
No Data
Related