Customising distance measurement using NDT

Today I'm working on distance measurement using NDT.  I have the example code running (on two Thingy:91s).  My next step will be to optimise the code so that rather than running identical code on both devices, I will have one (mobile) device where power consumption is important and a second (fixed) device where it's less of an issue.  I would like the mobile device not to scan for advertisements; looking at this https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/samples/bluetooth/nrf_dm/README.html it seems that it should be possible, but if I just disable scanning on the mobile device then I don't get any distance measurements at all.  I can't immediately see why that is.

Can you please confirm whether distance measurement is possible with only one device scanning, and if so how I should modify the example to do this.

Thanks,

 Frog

  • Thanks Amanda, that's much appreciated.  I've been diverted to another task for a few days but will get back to this in due course.

  • Hello, I tried your code and this works. 
    But when I took much more devices (15 ps) in mode WithoutScanning and only one device WithScanning, I get most of ranging with error:

    Timeslot allocation failed (err -16)

    Here you can see full log (with some of my custom logs):

    m_first_element_index: 33, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.38
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 48 e1 7a bf; timestamp: 91302; m_curr_index: 33
    m_first_element_index: 34, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.98
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 ea 26 d1 bf; timestamp: 91627; m_curr_index: 34
    m_first_element_index: 35, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-1.63
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 e6 98 9e 3f; timestamp: 94246; m_curr_index: 35
    m_first_element_index: 36, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=1.24
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 1f 3a c6 be; timestamp: 96229; m_curr_index: 36
    m_first_element_index: 37, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.39
    
    save result: 5e 30 a9 bb 7d d3 9e fe 08 be; timestamp: 96339; m_curr_index: 37
    m_first_element_index: 38, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.13
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 d8 a3 f0 be; timestamp: 99281; m_curr_index: 38
    m_first_element_index: 39, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.47
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 6f 12 03 3c; timestamp: 100013; m_curr_index: 39
    m_first_element_index: 0, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.01
    
    save result: 5e 30 a9 bb 7d d3 c9 76 3e 3f; timestamp: 100120; m_curr_index: 0
    m_first_element_index: 1, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.74
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 96 43 0b 3e; timestamp: 100427; m_curr_index: 1
    m_first_element_index: 2, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.14
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 15 ae c7 3e; timestamp: 101396; m_curr_index: 2
    m_first_element_index: 3, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.39
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 9e ef 67 3f; timestamp: 101801; m_curr_index: 3
    m_first_element_index: 4, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.91
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 9e ef 67 3f; timestamp: 104442; m_curr_index: 4
    m_first_element_index: 5, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.91
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    
    save result: 5e 30 a9 bb 7d d3 69 91 ed bd; timestamp: 105592; m_curr_index: 5
    m_first_element_index: 6, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.12
    
    save result: 5e 30 a9 bb 7d d3 bc 74 b3 3f; timestamp: 105700; m_curr_index: 6
    m_first_element_index: 7, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=1.40
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 58 39 b4 3c; timestamp: 109484; m_curr_index: 7
    m_first_element_index: 8, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.02
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 df d7 04 3f; timestamp: 110323; m_curr_index: 8
    m_first_element_index: 9, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.52
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 9d c4 60 3f; timestamp: 110743; m_curr_index: 9
    m_first_element_index: 10, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.88
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 b7 5c 65 bf; timestamp: 111460; m_curr_index: 10
    m_first_element_index: 11, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.90
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 48 e1 fa be; timestamp: 112616; m_curr_index: 11
    m_first_element_index: 12, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.49
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 86 a0 ec be; timestamp: 113037; m_curr_index: 12
    m_first_element_index: 13, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.46
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 9c c4 80 3f; timestamp: 113139; m_curr_index: 13
    m_first_element_index: 14, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=1.01
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 72 1e fa be; timestamp: 113866; m_curr_index: 14
    m_first_element_index: 15, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.49
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 0b d7 83 3f; timestamp: 114399; m_curr_index: 15
    m_first_element_index: 16, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=1.03
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 02 2b 07 3e; timestamp: 115550; m_curr_index: 16
    m_first_element_index: 17, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.13
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 13 83 00 bf; timestamp: 117528; m_curr_index: 17
    m_first_element_index: 18, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.50
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 0d 2f 8e 3e; timestamp: 122441; m_curr_index: 18
    m_first_element_index: 19, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.28
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 0b d7 83 3f; timestamp: 124840; m_curr_index: 19
    m_first_element_index: 20, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=1.03
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 c5 20 b0 bd; timestamp: 126823; m_curr_index: 20
    m_first_element_index: 21, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.09
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 67 66 66 bf; timestamp: 127240; m_curr_index: 21
    m_first_element_index: 22, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-0.90
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 46 b6 33 3f; timestamp: 136181; m_curr_index: 22
    m_first_element_index: 23, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=0.70
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Ranging failed (nrf_dm status: 1)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 77 be 9f bf; timestamp: 136793; m_curr_index: 23
    m_first_element_index: 24, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-1.25
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    
    save result: 5e 30 a9 bb 7d d3 ae 1b 8c bf; timestamp: 136901; m_curr_index: 24
    m_first_element_index: 25, m_dm_result_array_size: 40
    Measurement result:
            Addr: D3:7D:BB:A9:30:5E (random)
            Quality: ok
            Distance estimates: rtt: rtt=-1.09
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    D: Timeslot allocation failed (err -16)
    

    I get:

    - 33 Measurement result

    - 22 Ranging failed (nrf_dm status: 1)

    - 772 Timeslot allocation failed (err -16)

    So, I find some configs, by default:

    CONFIG_DM_INITIATOR_DELAY_US=1000
    CONFIG_DM_MIN_TIME_BETWEEN_TIMESLOTS_US=8000
    CONFIG_DM_TIMESLOT_QUEUE_LENGTH=40
    CONFIG_DM_TIMESLOT_QUEUE_COUNT_SAME_PEER=10
    CONFIG_DM_TIMESLOT_RESCHEDULE=n
    CONFIG_DM_RANGING_OFFSET_US=1200000

    My full config file:

    7360.prj.conf

    Add also, that devices works in DM_RANGING_MODE_RTT mode.

    So, the question is what should I change to have better results?

Related