I’ve been doing some testing with the DWM1000 module and simple ranging. I’m using a modified version of the example source code ex_05a_ds_twr_init.c and ex_05b_ds_twr_resp.c, running on my own platform.
I see the example code does two round-trips (3 messages, A->B, B->A and A->B again) then calculates Ra, Da, Rb and Db, and uses these figures to calculate the ticks-of-flight and ultimately the distance.
I was interested to see whether the system would work reliably with only one round-trip (A->B and B->A). However, the distances calculated are much less accurate this way.
e.g. Typical values for my setup (the actual distance apart is approx 2.5m)
Ra 340805323 Da 609500981 Rb 609501172 Db 340803504
Two way trip calculations using Decawave software formula: Ticks of flight 614 Distance 2.88m
One way trip (Ra – Db) / 2: Ticks of flight 909 Distance 4.26m
One way trip (Rb – Da) / 2: Ticks of flight 95 Distance 0.45m
My guess would be that the initiator clock is running faster than the responder, hence the difference. In fact if I swap the hardware round so the chip previously used for the initiator is now the responder, and vice-versa, the difference changes too.
Is this expected?