TWR betwwen "random" nodes

I am looking for some ideas to implement TWR between each other without use of Anchors (I do not need location, only range between the nodes). My target processor is ESP32 and my hardware can get node ID of other nodes nearby (So, they can know what to poll).

I think the main issue is the routine to be an Initiator (to ping the list of ID of nodes nearby) and quickly go back to being a responder.

Maybe there is a better way of doing this?


1 Like

The way I’ve done this is to have a single interrupt driven library for all devices.

When a UWB packet is received it generates an interrupt, the type and destination ID is checked and a response sent (or set as a delayed transmit) if required. If no response is needed the system returns to receive mode and waits for the next rx interrupt. If the received packet was the last one needed to calculate a TWR then the time data is copied to a buffer and a flag set notifying the system that the range measurement is complete.

The only difference between being an initiator and an anchor is purely whether the transmit function is called from an outside source to start a TWR exchange. Since this code is common to all devices an initiator that is not actively measuring a range is an anchor and any anchor can initiate ranges. The only distinctions between the two are at a higher level in the overall system code rather than in the UWB library.

Thanks Andy,

Are you saying you write code that runs on the DW1001 and processes receive events than generates rx interrupt for host micro when range measurement is ready? And you then issue a Transmit command from the host micro to DW1001 if you want to initiate a ranging session?

Or, are you saying you do this all on the host micro and use SPI commands to do everything?

This is on custom hardware so the library is running on my processor talking directly to the DW1000 chip over SPI. So by interrupt I mean the IRQ line from the DW1000 chip.

But as with most things there are lots of different ways you could implement a very similar system.

Hi Andy,
What processor have you used and did you write the deca drivers yourself or just port the drivers from the deca examples?

It’s an LPC54113. The driver is an evolution of DW1000 - DW1000 UWB driver based on work of Matthias Grob … | Mbed
That code was used for our initial proof of concept but hasn’t been maintained since then. Having said that other than a couple of minor bug fixes I don’t think there were any significant changes made to that code.

Unfortunately all of the range measurement and position calculation code that build on top of this is proprietary. That’s where the radio protocols and all the tricks to gain accuracy live.

We have also got a proof of concept DW3000 system running. That involved hacking the supplied c based DW3000 drives into our c++ based code. It wasn’t pretty. I would have much rather modified our existing drivers but the DW3000 documentation is shockingly poor with sections simply telling you to look at the driver source code for how to do something. The drivers then modified registers that weren’t even listed in the documentation.