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

Address Filter not working

I have an NRF52 DK, and an IM21 door sensor that advertises events. I am trying to pick up these events with the nRF52DK in the most robust way possible. I have used the scanning library to implement an address filter to identify the IM21 events by the IM21 adress. My implementation is screenshotted below and I have verified that the address and address type are correct.

This code is in the scan_init() function:

I am verfying that the sensor is found through this print statement below, which isn't printing:

I also picked up the packets that are being advertised with the NRF Sniffer. The packet advertised is highlighted in this image below:

I welcome any ideas regarding where I may have gone wrong or missed something of importance.

Thank you very much, 

Maria

Parents
  • Hi Maria

    Thank you.

    nrf_ble_scan_start() returning error 9 means that there is an invalid length somewhere in this function. Likely returned from the sd_ble_gap_scan_start() function which would indicate that the provided buffer length is invalid. What have you set the buffer length to? The scan buffer length  for an advertising set should be 31 bytes. If you set the scan param extended bit to 1, a scan buffer length of 255 is allowed.

    Best regards,

    Simon

  • Hello,

    Thank you - I changed the extended bit to false and now it is running with no errors! However, the scanning module is still not recognizing my iBeacon.

    I made some changes to the scan_evt_handler() function and it now looks like this:

    In summary, if it sees an advertisement with an address that does not match IM21_ADDRESS, it prints the address it saw. If it sees an advertisement that matches the IM21_ADDRESS, it prints a "Door Sensor Found" message.  As the door sensor iBeacon advertises, I see it's address being printed, meaning that the scanning module sees the advertisement, but it appears that the address doesn't match.

    This is what is printed (the correct first three bytes of the address): 6bc651 

    This is what the address is set as:

    I don't know what is going on - is the peer address different from the direct address? How can I get the address filter to recognize the address? I checked to make sure that the address type was correct.

    Best,

    Maria

  • Can you confirm whether or not the beacon actually advertises the full address, and not just these three bytes? It could be that the iBeacon tries to advertise more than 31 bytes, and therefore some of these address bytes are cut out of the advertisements, causing only 3 of them to be advertised, and would explain why the scanner can't confirm the address.

    Best regards,

    Simon

Reply Children
  • Hello,

    Apologies for being unclear; the scanning library recognizes all 6 bytes, I was just printing the first 3. When I print the full 6 bytes it matches the address of the iBeacon door sensor.

    I used the nrfSniffer firmware with the nrfConnect application to get the complete address and payload. You can see the full address in the image below under iSensor, and you can see the full payload below under ManufacturerSpecificData. Let me know if you have any more thoughts.

    Thanks,

    Maria

Related