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

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.

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 ?

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 ?

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:

Hi Jacob, did you find the answers to your questions? I’m also interested in NLoS computation. I have done some tests and apparently the value obtained with this code is not correlated with the measurement error so it is not good to estimate if the distance estimation is valid or not. Did you go any further?

I did not find any answers to my questions, however; I ended up re-writing the NLoS calculation based on the information from the application note (APS006 PART 3) and the manual using the Ipatov method. The code is available here:

the most notable differences from the example code is:
. the removal of STS[12] (we’re not using PDOA)
. the division by 64 instead of 32 (for the six bit fraction in the 10.6 fixed point number).
. math/code simplifications to spare some needless floating point calculations.

Also - make sure to clear the “MINDIAG” bit at initialization time for any of this to work (to enable diagnostics):

Hi Jakob,
thank you for your answer. I fixed my code (I’m using the Qorvo API) with the division by 64 instead of 32 but It did not improve much. The probability of NLoS most of the time is computed by using the difference between first path power and received signal power and this is not explained in the application note (that is written for the DWM1000). Also, I find strange that the mc coefficient (in the AP) is not used in the Qorvo example.