DWM1000 Ranging problem (Calibration?)

Hello everyone, this is my first post.
Apologizes if the same problem has been posted before.(I haven’t search for similar problem.) Orz

I recently try to integrate DWM1000 module into my PCB board (Cortex M0), but I met some problem about the ranging.

I want to implement the ranging method as this picture
(The [color=#ff3333]red [/color]and [color=#3333ff]blue [/color]number shows the timestamp I collect from Device A and Device B)

The distance I calculate is 153.88 meters, but the actual distance is between 1 meter ~ 2 meters.
The formula I use is as the picture above.
After I collect all timeStamp I need, I could calculate the T_prop.
And I transfer the T_prop to distance(meter) by multiply the 0.0046917639786159f.
I think the problem is occurred from the timeStamp I collect.
(I have checked the calculation process in “each timeStamp->T_prop” and “T_prop->Distance”. )

I posted some picture about part of my code, and add my source code.
If anyone can solve my problem, I really appreciate!!

This picture shows the configuration(After device name) and the communication ([color=#3333ff]As [Anchor] role!![/color]):

This picture shows my main function([color=#3333ff]As [Anchor] role!![/color]):

This picture shows the DWM1000_Initialization([color=#3333ff]As [Anchor] role!![/color]):

This picture shows rxcallback function ([color=#3333ff]As [Anchor] role!![/color]):

This picture shows txcallback function ([color=#3333ff]As [Anchor] role!![/color]):

Source code link (Google drive):

Really appreciate your assistance and patience again.
:smiley: :smiley: :smiley:

Jacky Su

What values do you use for TX/RX antenna delays?

Hello, i have a similar problem. I checked your code and i could notice that you are using an old version of the api.

I keep waiting for an update of this topic too.


Hello, I didn’t set the value for TX/RX antenna delays.
I think the value is default (no delays).
Thank you! :slight_smile:

Hello, thank you for informing me the api I used is old version.
I will check this part.
Hope we can figure out this problem ASAP.

Thanks :slight_smile:

Hi, Jacky

After reading your problem, antenna delay must be set. It’s not be zero.

You can use the dwt_setrxantennadelay(n) and dwt_settxantennadelay(n) API to set antenna delay, the variable n is about 16418.744

I hope it helps you.

Hi, Jacky.

After reading your problem, you must be set antenna delay to make timestamp correct.

You can use api dwt_settxantennadelay(uint16 n) and dwt_setrxantennadelay(uint16 n) to set delays, the variable is about 16418.744.

I hope it helps you.

Thank you very much!
After adopt your advice, the problem is figured.