TX frames stability


I’m using NRF52 and DW1000. My main goal is to send “timestamp” every 10ms : it has to be very stable and regular (on the order of the nanosecond would be perfect).
First, I used deca_sleep(10), it was working but not good enough : I’m doing the difference between to timestamp and then I divide it by 64000 (clock). I can easily have the average deviation to know if it’s stable : it’s not.

I then implement a 10sc timer with an interruption routine. It’s quite better, but there is still some variations between each dwt_starttx ; it seems that it’s not always taking the same time. I read somewhere on the datasheet that the DW1000 is put in a sleep state before next ranging attempt ?
Actually, I don’t care about power consumption so, if can disable it, maybe it would be more stable?
Or, maybe there is some SPI things to fix, I have no clue… If someone has any idea to optimize the regularity of the dwt_starttx(0) would be great!


Perhaps you would benefit from the delayed transmit feature? Section 3.3 of the User guide

The DW1000 transmits with 8ns precision, please see section as Lincoln pointed out. If you want regular transmissions, this would be easily achieved with delayed TX.

Thank’s for these information. I saw the section that Lincoln pointed but I have not find how change the “delayed time” ? They say that the ‘transmit time’ is programmed into register 0x0A (-> DX_TIME_ID) which is used by this function :

[code]void dwt_setdelayedtrxtime(uint32 starttime) //

dwt_write32bitoffsetreg(DX_TIME_ID, 1, starttime); // Write at offset 1 as the lower 9 bits of this register are ignored

} // end dwt_setdelayedtrxtime()[/code]
I then tried in my while(1) loop : dwt_setdelayedtrxtime(time_ms);dwt_starttx(1);
However, it doesn’t change my TX sending speed.

Thank’s again for helping!

DX_TIME register holds the TX timestamp value (in the future), once the transmission completes, you need to reprogram the time for the next transmission, and so on.

Note if the programmed time has already passed (when the DW1000 get the start delayed TX command) then it will abort the transmission.

Please look at simple examples provided by Decawave.

Thanks you for these information. I have already been looking for some of them as this one :
But, they all set up a delay for the rx and I don’t want that. Currently, even with these example I have not fixed my problem.

I understand that I have to reprogram the time but I have no idea of to set up ‘this delay timer’ before next transmission.

[code]uint32 tx_time;

		 tx_time = (POLL_TX_UUS*UUS_TO_DWT_TIME)>>8;
		 //final_time = (((uint64) (tx_time & 0xFFFFFFFE)) << 8)+ TX_ANT_DLY;
		// final_msg_set_ts(&tx_poll_msg[FINAL_MSG_POLL_TX_TS_IDX]

    /* Write frame data to DW1000 and prepare transmission. See NOTE 7 below. */
    tx_poll_msg[ALL_MSG_SN_IDX] = frame_seq_nb;
    dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_TXFRS);
    dwt_writetxdata(sizeof(tx_poll_msg), tx_poll_msg, 0); /* Zero offset in TX buffer. */
    dwt_writetxfctrl(sizeof(tx_poll_msg), 0, 1); /* Zero offset in TX buffer, ranging. */

I have tried out these kind of things but it always send my frame every ~17sc

The 40 bit timestamp rolls over every (2^40/(128*499.2e6)) = ~17.2 sec so it sounds like you’re not updating the delayed TX time for each transmission. The time is an absolute time (ignoring rollover) not a countdown or interval timer.

Something like this:

#define CHIRP_INTERVAL 2496000 // 10ms in upper 32 bit time units
uint32 tx_timestamp = CHIRP_INTERVAL;
while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS)) {};
tx_timestamp += CHIRP_INTERVAL;

Perfect ! TY