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.

  • 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

  • Hi, 

    The number of measurements done in a given time can be decreased by changing the advertising interval, from BT_GAP_ADV_FAST_INT_MIN_1 for example to BT_GAP_ADV_SLOW_INT_MIN

    In the case where there is 1 scanner and 5 advertisers, there may be a situation that the scanner will not be able to schedule a timeslot to take a measurement with one of the advertisers because it will be busy measuring with others.

    Reducing the number of measurements should help. In addition, you can add a software mechanism to monitor how often a measurement is performed with a given device. If with some measurements are too frequent, then do not add a measurement request for that device.

    Regards,
    Amanda H.

  • Thank you, your help is much appreciated . No more questions (for now ) ;)

Reply Children
Related