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

Receive Advertisement Packet in Mesh Beaconing Example

Hi,

Got some questions about receiving adv packet in Mesh Beaconing Example:

According to the description "The beaconing example also demonstrates the usage of the Packet RX callback. This functionality allows to receive all non-filtered, BLE-compliant advertisement packets in the application code. These packets are captured by @ref SCANNER". I expect getting the iBeacon advertising but during I run the example it's actually only received adv packet from another mesh node. I'm not sure if this is how the example exactly works. Is the example could scan and print all ble adv packet or I need implement it myself ?

Parents
  • HI,

    The Beaconing example should print info for all packets received, as is. This is done in main.c with the function rx_cb, which is a callback function that gets registered by the line "nrf_mesh_rx_cb_set(rx_cb);" in mesh_init() also in main.c.

    What does the output that you do get look like? Can you share it?

    Regards,
    Terje

  • Hi Terje,

    Here's what I got after I flash the example,

    <t: 0>, main.c, 225, ----- Bluetooth Mesh Beacon Example -----
    <t: 13436>, main.c, 231, Initialization complete!
    <t: 18239>, advertiser.c, 323, advertiser_enable
    <t: 18241>, prov_bearer_adv.c, 408, PB-ADV: context at 0x20002F64 added to bearer
    <t: 18246>, mesh_app_utils.c, 65, Device UUID (raw): D5663AB3804DC24FB36A7B17B215CC75
    <t: 18249>, mesh_app_utils.c, 66, Device UUID : B33A66D5-4D80-4FC2-B36A-7B17B215CC75
    <t: 18257>, net_beacon.c, 368, net_beacon_enable
    <t: 18263>, main.c, 260, Bluetooth Mesh Beacon example started!

    And nothing print else while actually there are several ble device advertsing nearby. Until I turn on a mesh node I got this:

    <t: 7783267>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 7783275>, main.c, 87, RX [@237524360]: RSSI: -20 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7
    <t: 8102924>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 8102932>, main.c, 87, RX [@247279514]: RSSI: -23 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7
    <t: 8454414>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 8454422>, main.c, 87, RX [@258006141]: RSSI: -24 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7

    The example should also advertise it's name("Nordic Semi Mesh") according to the instruction but I can't find such node in nRF Connect App.

Reply
  • Hi Terje,

    Here's what I got after I flash the example,

    <t: 0>, main.c, 225, ----- Bluetooth Mesh Beacon Example -----
    <t: 13436>, main.c, 231, Initialization complete!
    <t: 18239>, advertiser.c, 323, advertiser_enable
    <t: 18241>, prov_bearer_adv.c, 408, PB-ADV: context at 0x20002F64 added to bearer
    <t: 18246>, mesh_app_utils.c, 65, Device UUID (raw): D5663AB3804DC24FB36A7B17B215CC75
    <t: 18249>, mesh_app_utils.c, 66, Device UUID : B33A66D5-4D80-4FC2-B36A-7B17B215CC75
    <t: 18257>, net_beacon.c, 368, net_beacon_enable
    <t: 18263>, main.c, 260, Bluetooth Mesh Beacon example started!

    And nothing print else while actually there are several ble device advertsing nearby. Until I turn on a mesh node I got this:

    <t: 7783267>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 7783275>, main.c, 87, RX [@237524360]: RSSI: -20 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7
    <t: 8102924>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 8102932>, main.c, 87, RX [@247279514]: RSSI: -23 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7
    <t: 8454414>, net_beacon.c, 419, SNB RX ID: 54D021362603E40E ivu: 0 kr: 0 IV: 0
    <t: 8454422>, main.c, 87, RX [@258006141]: RSSI: -24 ADV TYPE: 2 ADDR: [98:fe:b7:55:a6:eb]: 172B010054D021362603E40E00000000C1ABE802E7AEC2C7

    The example should also advertise it's name("Nordic Semi Mesh") according to the instruction but I can't find such node in nRF Connect App.

Children
  • Hi,

    I have now tested the examples/beaconing/ example from the nRF5 SDK for Mesh v4.0.0, on an nRF52840 DK (the PCA10056 v1.0.0) and it works just as in the descriptions here. I get prints for advertising packets scanned from several other devices, and the device itself advertises as "Nordic Semi Mesh" as seen from nRF Connect for Android.

    What board are you using?
    What version of the nRF5 SDK for Mesh?
    Have you done any modification to the example?
    What version of nRF Connect, and on which device?

    Regards,
    Terje

  • Hi Terje,

    Thanks for answering. I'm using nRF52840 DK (the PCA10056 v1.1.0) ,nRF5 SDK for Mesh 4.0 and nRF Connect for Android v4.24.1. My device is OnePlus 7.

    I have modified the RADIO_POWER to POS8DBM and RADIO_MODE to RADIO_MODE_NRF_62K5BIT in order to enable long range. 

    I flashed another board with beaconing example, I notice that they can find each other and the advertisement packet contain the name"Nordic Semi Mesh". So actually it's advertising but I don't know why the App can't find it...

    Update: I change the RADIO_MODE back to default RADIO_MODE_BLE_1MBIT and now the App can find the node. So this is the reason for discovering but the node still can't scan for other advertising packets. And I'm not quite understand why there's no problem using long range radio mode with other example but not the beaconing. Any help with that?

  • Hi,

    Bluetooth mesh is actually only running on the 1Mbit mode from Bluetooth 4.2, and does not use neither 2Mbit nor long range features from Bluetooth 5. The advertising packet callback that you use for scanning while simultaneously running Bluetooth mesh, must use the same phy as used for the mesh protocol.

    While it is possible to use the scanner from the nRF5 SDK together with the mesh stack from nRF5 SDK for Mesh, it is not recommended as it means radio time is then time-division multiplexed between mesh stack and BLE stack. (Only one of the stacks has access to the radio at any given point in time.)

    You mention that you have no problem using long range with other examples, which other examples have you successfully used long range on?

    Regards,
    Terje

  • Hi Terje,

    I have changed back to default mode and now I can find other advertisements. However I found that only beacon with name can be found - I also tried create different advertiser in nRF Connect App and got the same result. Do I have to advertise the name to find them? 

    I also tried implement the nRF5 SDK scanner with mesh stack. You are right I got problems with time-division multiplexing. It would be better if the rx_cb could work properly. Is there anywhere I can change the scan window and interval for beaconing example? 

    I modified long range according to this. It could works with the light switch example.

  • Hi,

    With the callback from the mesh stack (registered with nrf_mesh_rx_cb_set) you will only get advertisements on the same phy as the mesh is running on. That means if you look for "normal" advertisements using 1Mbit and the mesh stack runs on coded phy you will not find those normal advertisements. The mesh stack calls the callback on all advertisements that it detects, there is no requirement of e.g. name.

    As mentioned in that other thread, on-air time for coded phy messages is eight times longer than for 1Mbit. This means two things: First, the chance of an advertisement packet arriving fully within a scan window is smaller. Second, the chance of a packet getting lost to noise/interference may increase (despite of the added error correction,) depending of the type of noise. Thus, which phy is best depends on the use case and RF environment.

    The mesh stack uses all available time for scanning. That is, when it does not need to send a packet it will scan. Values used by the mesh stack are BEARER_SCAN_INT_DEFAULT_MS and BEARER_SCAN_WINDOW_DEFAULT_MS, which are defined along with other parameters in <sdk root folder>/mesh/bearer/api/nrf_mesh_config_bearer.h. All of those can be overridden by defining them as preprocessor defines, so there is no need to change the mesh stack files for using other values.

    Regards,
    Terje

Related