Rx timestamp map to external timer

Hello,

is there a way to get an good rx timestamp by using an external timer by an host mcu?
When I receive a uwb message and the interrupt of rx_ok are called I can get the current timestamp of the external timer. But the messages are not always have the same length the and the rx timestamp are always different. Because I want build an uwb network based on TDMA, the dw1000/dw3000 clock are off when the tags are sleeping and should wake up at the correkt tdma time slot.

Option 1.) Measure the time diff of the r marker and the current time (dw1000/dw3000 clock) when the interrupt of the receive messsage called and compensate this time with my external timer.

Or some other Ideas or easier ways?

It depends entirely on what exactly you want to achieve and level of accuracy you want.
The decawave internal timer is accurate to around 15 ps (about 0.5mm at the speed of light). Assuming you are using a fast MCU with a clock running at 500MHz and feeding the interrupt pin into a timer capture pin then you could possibly get time resolutions of around 2 ns giving 60 cm accuracies.

Your MCU clock will be good enough to tell you which time slot you are in but no good enough to use for range measurements.
Once you wake up you will need to cope with the need for clock synchronisation. But you’d have to cope with that anyway since all the clocks will be at different rates, unless you have a distributed clock every single device will be running at very slightly different clocks speeds. Over short time periods (up to a few hours) this isn’t normally enough to matter in terms of timeslot determination but if you don’t account for it it is enough to be the largest error in range measurements over time periods of microseconds.

Thank you for your answer. The anchors devices using the deca clock to build the tdma beacons because there are always on. I know that ranging ist not possible with the mcu clock =). Thats not what I want. I mean I want to achieve a accuracy of approx. 1-10us of the mcu clock on tag devices, but I really don’t know what acurracy range is possible. My main question is how to get the timestamp in the mcu timer depend on rx beacon messages.

It will depend on your MCU but most have at least one 32 bit timer with a configurable clock divider to give almost any rate you may want. Most can be set to run at either CPU speed or at least half CPU speed. So that will give you a high resolution MCU clock.

Feed the Interrupt from the decawave into a timer capture pin. That will store the timer value when the pin goes active.
If it was a receive interrupt then read the capture register. You now know the internal timer value that corresponds to the decawave time for that packet reception.
You can then add the appropriate amount to the capture registers value to give you the internal MCU timer value for when you next need to do something, set a timer match register to that value and wait for it to generate an interrupt at the required time.

If you only need 1 us resolution you could probably manage without the capture register, just read the timer value on a decawave interrupt.

Keep in mind that the receive time stamp from the decawave chip is for a marker at the end of the header but before the data payload while the interrupt to your processor will be once the packet reception is complete. Depending on how accurate you want things to be and how much data is in your packets you may want to adjust the values to allow for this.

1 Like