br101 / libdeca

UWB Library for Decawave/Qorvo DW3000
GNU Lesser General Public License v3.0
7 stars 1 forks source link

Ranging with multiple anchors #3

Open gilbertgit opened 3 months ago

gilbertgit commented 3 months ago

Does the lib allow for ranging with multiple anchors? (aka, 1 tag to 3 anchors...?) I just get RX timeouts as soon as I add another anchor to range to. How would you implement this? Thanks again for your help.

br101 commented 3 months ago

the library doesn't support ranging with multiple ancors at once. i haven't figured out a good way to do that.

i range with each of them sequentially. something like:

uint16_t anc[] = { 0x0001, 0x0002, 0x0003 };

for (int i = 0; i < 3; i++) {
    twr_start(anc[i]);
    // wait for TWR to be finished, i usually use a semaphore which i give in the twr callback
}
gilbertgit commented 3 months ago

So this is what I have been trying but not having any luck. I'll try to explain what I'm seeing. If I range between 1 anchor and 1 tag, everything is working great. As soon as I try to range to another anchor, the first anchor will receive the first message and the second anchor does not. THEN neither of the anchors will not receive any other messages after that. If I restart the first anchor, it will receive one time again. It's really odd that just by trying to send to the second anchor, the first one freezes up. Have you seen anything like this?

br101 commented 3 months ago

Hi, yes I have seen this, but only when CONFIG_DECA_XTAL_TRIM was enabled (it causes the clock drift to be adapted to the last sender).

First, I assume you are using latest versions of decalib and decadriver...

To debug this, maybe activate IRQ debugging (CONFIG_DECA_DEBUG_OUTPUT_IRQ) and see if you get any kind of interrupts.

Another thing I'd recommend is activating the frame filter (dwmac_set_frame_filter()) on all sides.

Last but not least, too much of a temperature change can cause the clocks to drift too much. so you should run dwhw_calib_if_temp_change() every once in a while...

Hope that helps...