The NRF52840 can not filter by MAC Address other BLE devices that are from other manufacturers.

Hi all!

I am working in a BLE scanner but I have enabled the filter by MAC ADDRESS.  I can filter  beacons that are produced  based in NRF52 and NRF51. But when i try set a MAC ADDRESS of a SOC produced by other company  the filter no match.

wich could be the problem?

Parents Reply Children
  • I store the MAC ADDRESS in array of char, I put them in reverse (LSB  --> MSB) attach an example:

    char target_device[][6] = {
    {0x96, 0xEA, 0x57, 0x6E, 0x91, 0xDF},
    {0x13, 0x48, 0x35, 0x79, 0xBE, 0xEB},
    {0x68, 0xDA, 0xFC, 0x71, 0x77, 0x60},
    {0xBF, 0x92, 0xD9, 0x70, 0xAF, 0xFD},
    {0x8C, 0x4B, 0x7A, 0xD6, 0xAB, 0xFE},
    {0x0E, 0x2B, 0xE6, 0x5A, 0xA8, 0xE7},
    {0xC3, 0x6B, 0xD2, 0x56, 0x79, 0xEB}
    };

    I have try put the MAC ADDRESS in the normal form (MSB--->LSB), but it does not work.

    For set the filter I use the following code:

     //Setting filters for scanning.
    
    
        int rows =  sizeof (target_device) / 6;
    
        for (int t=0 ; t<rows; t++)
        {
              char td[] = { target_device[t][0],target_device[t][1]  ,target_device[t][2]  ,target_device[t][3] ,target_device[t][4]  ,target_device[t][5]};
              
              err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, td);
              
              APP_ERROR_CHECK(err_code);    
        }
    
       
         err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER, false);
         APP_ERROR_CHECK(err_code);

    I attach the devices that I want to scan:

  • Not sure I understood this correctly, but I don't see the addresses of the beacons in your filter list?

  • i do not place them, It is only a example of how I Set the ADDRESS filters. But, If I code the ADDRESS of the two beacons from the  images in the same formant, they does not work.

  • I just replicated your setup on my end, and it works just fine. I can see both my nRF52 DK and my headset, which most probably doesn't use a Nordic chip.

    One possibility is that the other devices are advertising with random addresses, which could change between when you recorded it into your filter code and when you run the test.

    If you force the advertising address of the nRF52 and nRF51 into one of the non-Nordic addresses you are expecting, does the filter work?

    If all fails, could you please get us a sniffer trace? We can try to see what is wrong.

  • One possibility is that the other devices are advertising with random addresses, which could change between when you recorded it into your filter code and when you run the test.

    The addresses of the devices are always the same, at least, in Nordic Connect  app.

    If you force the advertising address of the nRF52 and nRF51 into one of the non-Nordic addresses you are expecting, does the filter work?

    If I set a custom ADDRESS (one that I created) into nordic device, the filters work.

    I has been test other devices and I could filter a ble device from other company (Texas Instrument), but when I try set other filter of a diferent TI device, I can not filtered :(  for example:

    I have three beacons (attach photo and the information that NRF connect provide me):

    Beacon 1 (Nordic SOC):

    Beacon 2 (Texas Instrument):

    Beacon 3 (Texas Instrument):

    The beacon1 and the beacon 2 I could filtered with out problems, but the Beacon 3 I could not filtered and the filters are set  with the same metodh:

    store the ADDRESS in a array:

    char target_device[][6] = {
    {0x96, 0xEA, 0x57, 0x6E, 0x91, 0xDF},
    {0xEE, 0xA2, 0x65, 0xED, 0x04, 0x18},
    {0x68, 0xDA, 0xFC, 0x71, 0x77, 0x60}
    };

    set and enable the filters:

    static void scan_init(void)
    {
        ret_code_t          err_code;
        nrf_ble_scan_init_t init_scan;
    
        memset(&init_scan, 0, sizeof(init_scan));
    
        init_scan.connect_if_match = false;
        init_scan.conn_cfg_tag     = APP_BLE_CONN_CFG_TAG;
        init_scan.p_scan_param     = &m_scan_param;
    
        
    
        err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
        APP_ERROR_CHECK(err_code);
    
        //Setting filters for scanning.
    
    
        int rows =  sizeof (target_device) / 6;
    
        for (int t=0 ; t<rows; t++)
        {
              char td[] = { target_device[t][0],target_device[t][1]  ,target_device[t][2]  ,target_device[t][3] ,target_device[t][4]  ,target_device[t][5]};
              err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, td);
              APP_ERROR_CHECK(err_code);    
        }
    
        
       
         err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER, false);
         APP_ERROR_CHECK(err_code);
     
    }
    

    Enabling filters for the Scanning Module:

    // <e> NRF_BLE_SCAN_FILTER_ENABLE - Enabling filters for the Scanning Module.
    //==========================================================
    #ifndef NRF_BLE_SCAN_FILTER_ENABLE
    #define NRF_BLE_SCAN_FILTER_ENABLE 1
    #endif
    // <o> NRF_BLE_SCAN_UUID_CNT - Number of filters for UUIDs. 
    #ifndef NRF_BLE_SCAN_UUID_CNT
    #define NRF_BLE_SCAN_UUID_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_NAME_CNT - Number of name filters. 
    #ifndef NRF_BLE_SCAN_NAME_CNT
    #define NRF_BLE_SCAN_NAME_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_SHORT_NAME_CNT - Number of short name filters. 
    #ifndef NRF_BLE_SCAN_SHORT_NAME_CNT
    #define NRF_BLE_SCAN_SHORT_NAME_CNT 0
    #endif
    
    // <o> NRF_BLE_SCAN_ADDRESS_CNT - Number of address filters. 
    #ifndef NRF_BLE_SCAN_ADDRESS_CNT
    #define NRF_BLE_SCAN_ADDRESS_CNT 20
    #endif
    
    // <o> NRF_BLE_SCAN_APPEARANCE_CNT - Number of appearance filters. 
    #ifndef NRF_BLE_SCAN_APPEARANCE_CNT
    #define NRF_BLE_SCAN_APPEARANCE_CNT 0
    #endif

    but only the beacon 1 and beacons 2 trigger the NRF_BLE_SCAN_EVT_FILTER_MATCH. However, the beacons 3 I can see it int he NRF_BLE_SCAN_EVT_NOT_FOUND, with the same ADDRESS (but flip) that I set in the filter

    any idea what is the problem with beacon 3?

    Eudaldo

Related