Github code for dwm1001-dev can't change source and dest

Hello!

I’ve just bought a RaspberryPi and some dwm1001-dev boards. Using the github code provided by Decawave (https://github.com/Decawave/dwm1001-examples/tree/master/examples/ss_twr_init) I managed to see the distance between two boards.

How ever, when I create a new sort of msg that would look something like this

static uint8 init_tx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'I', 'T', 0x1, 0x2};

Where INIT would be an initialized process instead of ranging. The last two 0x1 and 0x2 would be the ID of the board sending this statement.

The problem is when I check the status_reg

if (status_reg & SYS_STATUS_RXFCG)

When sending these messages status reg is 0x28200f2 and SYS_STATUS if 4000 and when I’m sending ranges it’s 0x2806ff2 4000.

The strange thing is if I’m change INIT to WAVE it works just find and I get a replay, but I got no idea why it won’t replay when having init instead.

Thanks for your help!

:slight_smile:

you need to read the 802.15.4 standard and understand frame formats… In your example tx_msg [] - 0x41 and 0x88 are frame control bytes, followed by seq. number and 2 byte PAN ID = 0xdeca, then comes the destination and source addresses (2 bytes each). you need to have the correct address programmed at the receiving device. If the destination address is ‘I’, ‘N’ , i.e. 0x4e49. then you need to program this into the receiving device too.

Hi Zoran!

Yes, I read that standard. But I have already changed it in my receiving device as well, but it still wont work.
I tried to change my INIT to WAVE and VEWA and that worked fine.

To make it clear, in my sending device I got

static uint8 init_tx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'I', 'T', 0xE0, 0, 0};
static uint8 init_rx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'T', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

And in my recv device

static uint8 init_rx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'I', 'T', 0xE0, 0, 0};
static uint8 init_tx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'T', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

But as I said, when I change INIT to WAVE and ITIN to VEWA it works just fine.

ok, strange,

I had a look at the c code in the github and it does not use frame filtering, it compares the tx/rx buffers in the software after the frame is received.

Is this failing or something else: if (memcmp(rx_buffer, rx_poll_msg, ALL_MSG_COMMON_LEN) == 0) ?

What data do you get? Maybe the seq. number does not match?

Z

Yeah I thought so too, but I do not change the seq. number or anything. It seems like it does not send at all from the sender side. As I said, the status_reg is different when it works and when it does not. With that being said, I checked the dwt_starttx and it sure returned a 0 which, according to the API means it send it. Also, in the recv when debugging it doesn’t seem to receive anything.

My status_reg is being set as in the github.

 while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_TO | SYS_STATUS_ALL_RX_ERR)))

Ok, so the Initiator does not get the response, but does the responder receive the poll message?

Exactly! I wonder if it’s some sort of setting that only allows WAVE to be sent? But it shouldn’t be, right?

This is truly weird.

In my example right now, I got on the sender device

static uint8 tx_poll_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'V', 'E', 0xE0, 0, 0}; static uint8 rx_resp_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'V', 'E', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static uint8 init_tx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'T', 'A', 0xE0, 0, 0}; static uint8 init_rx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'T', 'A', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

And the recv device

static uint8 rx_poll_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'V', 'E', 0xE0, 0, 0}; static uint8 tx_resp_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'V', 'E', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static uint8 init_rx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'I', 'N', 'T', 'A', 0xE0, 0, 0}; static uint8 init_tx_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'T', 'A', 'I', 'N', 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
With this setting the rx message won’t work. However if I change the letters INTA to INVE as well as TAIN to VEIN it works like a charm.

Is there anyone that has a clue of why this happens?

EDIT:
After further debug I realized that the init_rx message has to be the same as the rx poll message, the same goes for the tx message.

FINALLY!
Stupid me, I forgot in the recv device to invoke the dwt_setdelayedtrxtime() function. Read in the API that it has to be called before dwt_starttx().

Thank you zoran for the help!