DWM1001 Examples - ss_twr_init additional code to read from 3 anchors?

I was able to successfully install to my DWM1001-DEV kit, the examples-master code to read distance between one initiator programmed unit using ss_twr_init and one resp (anchor) unit using ss_twr_resp, but not sure how to code to read for 3 anchors.

Has anyone programmed this and can share the code?

The short version is:
Each responder is given a unique ID.
The message sent from ss_twr_init needs to be modified to include the ID of the responder that it wants to talk to.
The responder reads the ID in the message, compares it to it’s own and only sends a response if they match. Otherwise it ignores the packet and goes back to listening for an initiator.

Generally this involves adding to and from fields to all the messages and setting a unique ID in each device. Technically you only need a To in the message from the the initiator and the initiator doesn’t need an ID. But giving everything an ID and including both source and destination in all messages gives a lot more flexibility and allows you to employ a consistent method to decide which packets to use and which to ignore. It also becomes important if you want to have more than one initiator.

There are lots of refinements you can add to this to improve update rate and reduce power usage but initially it makes sense to ignore that and keep things simple.

1 Like

Finally getting back to this. So, for a complete novice, if I’m looking at this snippet of code, part of the ss_init_main, what portion of the code gets updated to communicate with each anchor?

static uint8 tx_poll_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'W', 'A', 'V', 'E', 0xE0, 0, 0};
static uint8 rx_resp_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'V', 'E', 'W', 'A', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

Is it the β€˜W’, β€˜A’, β€˜V’, β€˜E’, portion to other text?

To be honest it doesn’t matter that much what part of the packet you change as long as you change the responder code to look for that change.
Personally if aiming for minimal changes I’d be tempted to change β€˜W’ β€˜A’ β€˜V’ β€˜E’ to β€˜D’ β€˜E’ β€˜V’ β€˜1’ and then change the 1 to a different number for each device. No reason it needs to be text, you could use 0x01 onwards, that would give you 256 possible devices with minimal changes.

1 Like

I got it figured out, thanks for all of the help!