Questions about Nordic Distance Measurement library sample

1. The code uses a value 0xFF55AA5A to identify the adv packet as the one that supports distance measurement. Is this value checked by  lower layers?

If not - why not just use 1 bit ?

2. The advertising interval in the sample is set to BT_GAP_ADV_FAST_INT_MIN_1 ( 30 ms )

Have slower intervals been tested ? My concern is the device battery life

3. My application uses mesh and its scanner ( registers a scanner callback )

Have the app been tested with mesh? 

Thanks

Parents
  • Hi, 

    From the team:

    The reason for this is that the reflector needs to start before the initiator. If you increase the gap between initiator and reflector (by making CONFIG_DM_INITIATOR_DELAY_US bigger, for example) you increase the time that the reflector is waiting for the initiator. This means that a more coarse synchronization is needed and the ranging is more likely to be successful. On the other hand it is increasing power consumption, because the reflector is waiting with the radio running.

    So these two configs are dependent on each other.

    Basically, only one of the configurations should be necessary and we can probably remove DM_REFLECTOR_DELAY_US. That one currently anyways defaults to 0.

    -Amanda H.

Reply
  • Hi, 

    From the team:

    The reason for this is that the reflector needs to start before the initiator. If you increase the gap between initiator and reflector (by making CONFIG_DM_INITIATOR_DELAY_US bigger, for example) you increase the time that the reflector is waiting for the initiator. This means that a more coarse synchronization is needed and the ranging is more likely to be successful. On the other hand it is increasing power consumption, because the reflector is waiting with the radio running.

    So these two configs are dependent on each other.

    Basically, only one of the configurations should be necessary and we can probably remove DM_REFLECTOR_DELAY_US. That one currently anyways defaults to 0.

    -Amanda H.

Children
  • If that's the case why then the sample starts a reflector in the scan response callback and reflector in the scan callback? I thought that the scan callback goes first then the other side sends scan response and the scan response callback is called. Maybe I got it all wrong Slight smile

  • Hi, 

    From the team:

    Scan and advertising facilities of the BLE is used to synchronize peers. If a Device acts as an advertiser in synchronization, it will act as the reflector in the ranging procedure. If a Device acts as a scanner in synchronization, it will act as the initiator in the ranging procedure. When ADV_IND, SCAN_REQ and SCAN_RSP are exchanged, new ranging request is added. ( dm_request_add). This is done cyclically.

    -Amanda H.

  • Is there communication between the 2 devices at the a lower level when the DM API are called? Or  is the ranging done locally and the dm_request_add  with different roles is only used by the library internally?

    If the latter is true then there should be a way to synchronize without an active scan ( which is what I'm trying to achieve ) I tried this 
    One side only advertises without a scan response
    The other side only scans.
    The scanner keeps a flag that tells it which role to use when a packet arrives i.e packet->is_initiator (initially false) which is flipped every time a new scan packet arrives i.e 
    scan callback:


    if(!packet->is_initiator){

    dm_request_add(REFLECTOR)

    }else{

    dm_reflect_add(INITIATOR)

    }

    packet->is_initiator = !packet->is_initiator

    This flips the role on every scan callback invocation

    But it does not work Disappointed

    Which implies that there is indeed some communication between devices at a level lower than scan and adv. Or is it the timing?
    Can you clarify and perhaps suggest a solution 

    I'd like to avoid using active scan

    Thanks

  • Hi, 

    The role of the device is set when adding a measurement request. https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/nrf_dm/src/main.c#L104-L109

    It is possible to assign a role permanently. The measurement in a given request is made between two devices.

    Adding a request on both devices must be synchronised.

    In the sample, you could comment out the if (peer_supported_test(info->addr)) line inside adv_scanned_cbcallback function to fix the scanner as the initiator. If the device only acts as a scanner then it will be initiator. Then another device should acts as an advertiser to act as reflector in the ranging procedure.

    -Amanda H.

  •  I have one device type set as an advertiser and it only issues reflector requests and another device is a scanner and it only issues initiator requests. This works quite well actually.  
    Question. I noticed that the library sends are a lot of measurement results in the scanner device - within a 10 second period there may be up to a 100.  I  tried to limit the number of initiator requests to 5 and get about 4-10  measurements within a 10 second period. . Is there any benefit in doing that?  The goal is not to overburden the library with requests in an environment with a lot devices. I tested with 1 scanner and  5 advertisers placed 1 -12 meters from the scanner. Sometimes a  device is  scanned (and initiator request issued ) but the measurement is not taken within a 10 second period.  Any suggestions, insights?
    Thanks

Related