DW1000 Example 5a/5b Double Sided TWR Periodic Ranging Drift

Hi all,

I’ve used example code for DW1000, 5a/5b for Double Sided TWR, to get ranging results on two DW1000 boards. The boards exchanging ranging data are at a fixed distance.

Downloaded DW1000 Application Programming Interface with STM32F10x Application Examples from Software - Decawave

The results are accurate to within the range of +/- 10cm as expected. But when the measurements are plotted with respect to time, I see a pattern as seen in the graph below. The pattern repeats with a periodicity of approximately 120s.

The ranging transactions execute every 100ms. I’m not sure where this periodicity in ranging results is coming from.

Any clues on understanding these results are much appreciated!


Switch one of the units off, let it cool down (say 30 minutes or so) and then power it up and start logging.
Is the pattern different for the first few minutes?

You could be seeing an artifact of the two units different clock rates beating against each other, if this is the case changing the temperature of one unit (by letting it cool down) will change the pattern until it gets back up to running temperature.

1 Like

I agree with Andrew’s comment, it is likely a function of the clock offset between the devices. Double-sides TWR will minimize the effect, but likely not absolutely negate it. You could try to minimize / change the CFO between the modules to see if this has any effect using the XTAL_TRIM register. See also APS011: Sources of error in TWR schemes.

It could also be a relative error in the floating point calculation done on the responder. The timestamps increase in value over time, the error could be bigger if larger values are used, resetting when the timestamps roll over. You can debug and look at the value of the timestamps to see if there is a correlation.

Can you specify the hardware you are using?

Can you launch SS-TWR examples on the same hardware (examples 6a and 6b)?
The SS algorithm is different form DS, if the root cause is some cumulative error in the floating point calculation it should give a different result.
I doubt that the counter rollover can be responsible for this – the 40bit counter has a period of only 17 seconds, the 32bit counter which is actually used by the DS-TWR algorithm rolls over after 66msec.