Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Detect and/or decode beacon advertisements on nRF Dev board

Hello,

I am trying to find an example application that I can run on my Dev board that will allow me to detect and decode advertising beacon and send the data out of the serial/log port when the event occurs.

I am working with the nRF5 SDK 17.1.0. The dev kit is nRF52-DK.

The examples that I have seen appear to want to connect to the target which the beacon does not do.

Any suggestions?

Thanks,

Allen

Parents
  • Hello Allen,

    You should use the Scanning Module to achieve this, and you can see an example of how this can be used in the BLE Blinky example.
    This way, you will have the advertising reports that match the filters you have added received in the scan module event handler.

    Best regards,
    Karl

  • Hello Karl,

    Thank you for pointing me in a direction to start.  Since this specific client application requires a device with the name "Nordic_Blinky", how can I go about looking for a specific UUID that would be embedded in the beacon advertising data instead?

  • Hello Karl,

    Using nRF_Connect, I captured this raw data from the beacon advertisement:

    // Raw data captured from the beacon using nRF_Connect
    // 0x0201041AFF4C000215 21 AD 05 3D 0D 9F 4B 55 A1 D6 96 3F 0E 3D D8 70 00640000C3

    I separated the UUID from the stream so it would be easier to see.

    When you say reverse the byte order, do you mean something like initializing as shown below:

    m_target_periph_UUID.uuid128[15] = 0x21;
    m_target_periph_UUID.uuid128[14] = 0xAD;
    m_target_periph_UUID.uuid128[13] = 0x05;
    m_target_periph_UUID.uuid128[12] = 0x3d;
    m_target_periph_UUID.uuid128[11] = 0x0d;
    m_target_periph_UUID.uuid128[10] = 0x9f;
    m_target_periph_UUID.uuid128[9] = 0x4b;
    m_target_periph_UUID.uuid128[8] = 0x55;
    m_target_periph_UUID.uuid128[7] = 0xa1;
    m_target_periph_UUID.uuid128[6] = 0xd6;
    m_target_periph_UUID.uuid128[5] = 0x96;
    m_target_periph_UUID.uuid128[4] = 0x3f;
    m_target_periph_UUID.uuid128[3] = 0x0e;
    m_target_periph_UUID.uuid128[2] = 0x3d;
    m_target_periph_UUID.uuid128[1] = 0xd8;
    m_target_periph_UUID.uuid128[0] = 0x70;

    Thanks,

    Allen

  • On a side note, I recompiled the app with the reversed UUID as shown above and got the same results of no Beacon detection or decode with the filter.

    Going back to the RF Sniffer, how would I specify in the python example the UUID or even the MAC address as the filter.  Below is the snippet of code from the example.py file:

    d = mySniffer.getDevices()
    # Find device with name "Example".
    dev = d.find('Example')

  • Hi,

    Karl is OoO so I am stepping in.

    Regarding the nRF Sniffer, that is intended to be used with Wireshark as a protocol analyzer, and the sniffer itself does not have any support for filtering on UUID or similar. So if you would want to do that you would have to implement it yourself.

    Regardign filtering UUID with the scan module in the nF5 SDK, note that the way UUIDs are handled in the SDK, you need to set the base UUID (when you get returned a UUID "type"), and later when you want to perfer to that UUID in the case of a 128 bit UUID you provide byte 12-13, and the type (see ble_uuid_t). You can see an example of this in examples/ble_central/ble_app_uart_c/main.c. If you use that as an example you also need to refer to components/ble/ble_services/ble_nus_c/ble_nus_c.c, where you can see that the base UUID is set with a call to sd_ble_uuid_vs_add(), and the type is the third parameter, which is an output from this function. (The base UUID is the full UUID, but with octet 12-13 set to 0x00).

  • Hello Einar,

    Maybe I am approaching this the wrong way.  Maybe I should look at using the Uart_c example rather than Blinky_c.  I just need a simple way to detect/decode a beacon module that does not send a name but rather sends out the MAC address and a specific fixed UUID as part of the beacon packet.  When that is detected/decoded, I would want to send it out the serial port as part of the debug log so I can capture it on the computer.  Would it be easier to move over to the Uart_c project and accomplish this or should I stay with Blinky_c?

  • I think the BLE blinky central is good as it is a simple sample. You just want to keep BLE scanning and logging, and remove the rest, so better to start off with a simpler sample with less to remove.

Reply Children
No Data
Related