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

How do I implement an address filter?

I am very new to BLE development, and am building my application on top of the ble_central\ble_app_uart_c example.

I have this tag defined at the start, with the other global variable definitions.

#define NRF_BLE_SCAN_ADDR_FILTER 0x02

This is the function where I am initializing the module: 

/**
 * @brief Parameters used when scanning.
 */
static const ble_gap_scan_params_t m_scan_params =
{
    .active   = 1,
    .interval = SCAN_INTERVAL,
    .window   = SCAN_WINDOW,
    .timeout  = SCAN_TIMEOUT,
    #if (NRF_SD_BLE_API_VERSION == 2)
        .selective   = 0,
        .p_whitelist = NULL,
    #endif
    #if (NRF_SD_BLE_API_VERSION == 3)
        .use_whitelist = 0,
    #endif
};
 

I am calling the module (or setting the filter, unsure of the terminology) here in the scan_start() function:

/**
 * @brief Parameters used when scanning.
 */
static const ble_gap_scan_params_t m_scan_params =
{
    .active   = 1,
    .interval = SCAN_INTERVAL,
    .window   = SCAN_WINDOW,
    .timeout  = SCAN_TIMEOUT,
    #if (NRF_SD_BLE_API_VERSION == 2)
        .selective   = 0,
        .p_whitelist = NULL,
    #endif
    #if (NRF_SD_BLE_API_VERSION == 3)
        .use_whitelist = 0,
    #endif
};

The scan_start() function is called in main(). I have not yet tested this implementation as it is unfinished.

My questions around this are:

  1. Where do I set the address I want to filter for? It merely advertises and I can't connect to it.
  2. Once the address is set, is this implementation correct?

Thank you!

Parents
  • Hi Karl,

    Hope you are well.

    Regarding the write error - I had the file open in another editor. Closing the second editor and restarting Keil IDE resolved the issue for me. Thanks for the idea.

    The address filter is now running without errors, but it is not picking up any advertising packets. My thought is that I have entered the address or address type incorrectly.

    I am determining whether or not an advertising packet is picked up by putting print statement in the scan callback function here:

    I implemented the NRF BLE sniffer and the output is shown below. The highlighted line is from the advertising sensor; I know this as the three bytes are part of the address of the specific device.

    This is how I have entered the address into Keil IDE:

    Do you have any ideas regarding what could be going on? Thanks for your help!

    Best, 

    Maria

Reply
  • Hi Karl,

    Hope you are well.

    Regarding the write error - I had the file open in another editor. Closing the second editor and restarting Keil IDE resolved the issue for me. Thanks for the idea.

    The address filter is now running without errors, but it is not picking up any advertising packets. My thought is that I have entered the address or address type incorrectly.

    I am determining whether or not an advertising packet is picked up by putting print statement in the scan callback function here:

    I implemented the NRF BLE sniffer and the output is shown below. The highlighted line is from the advertising sensor; I know this as the three bytes are part of the address of the specific device.

    This is how I have entered the address into Keil IDE:

    Do you have any ideas regarding what could be going on? Thanks for your help!

    Best, 

    Maria

Children
No Data
Related