NLOS detection - manual and example

Hello,

I’m working with detection of NLoS using the DW3000 - some questions surfaced when looking at the example code and the documentation.

The example code I’m referring to (can be obtained via product page) is:

DW3XXX_API_rev9p3/API/Src/examples/ex_02a_simple_rx/simple_rx_nlos.c

A few things are unclear to me regarding the NLoS calculations.

  1. the F1/F2/F3 point amplitudes are noted in the example code to have 2
    fractional bits - this is not mentioned in the manual, making it hard to
    reason about these calculations.
    In other places the manual describes fixed point layout - e.g. the 10.6 fixed point
    format used in the case of the IP_FP field of IP_DIAG_8.

  2. the integer division by 4 in the example code, e.x:

    ip_f1 = all_diag.F1 / 4;

    which simply throws away the 2 lower bits. That seems wrong when the left hand side is
    of type float. Maybe float division was intended? - e.g:

    ip_f1 = all_diag.F1 / 4.f;

    or maybe it should have been kept in integer until the log10 computation ?

  3. the calculation of D, ip_alpha, and alpha seems to be wasted as these terms cancel in the
    signal level difference calculations. They are not used anywhere else. Am I missing something ?

  4. the dwt_nlos_ipdiag API shifts up the index_pp_u32 value to match the aforementioned layout
    result of the IP_DIAG_8 (10.6 fixed point format) however the following index_diff computation:

    index_diff = ((float)index.index_pp_u32 - (float)index.index_fp_u32) / 32;

    only returns 5 bits (division by 32) instead of the expected 6 (division by 64).
    Am I overlooking a factor of 2 ?

Cheers…
/Jakob