Hi,
I’m working on a wireless synchronization method using the DWM1000. For the current tests we have a
transmitter which sends at regular intervals, like so:
[code] // first transmit is delayed by the given interval (be safe with program delays)
uint32_t zulu_time = dwt_readsystimestamphi32() + interval;
for (int i=0; i<messages; i++, zulu_time += interval) {
anchor_message.superframe_no++;
write_txdata(&anchor_message);
/* Set transmission time */
dwt_setdelayedtrxtime(zulu_time);
/* Start transmission, no response as anchor 0 */
dwt_starttx(DWT_START_TX_DELAYED);
/* wait for interrupt by suspending, callbacks are called here */
resume_on_dwm1000();
}
[/code]
write_txdata() composes the message and does:
/* Write frame data to DW1000 and prepare transmission */
dwt_writetxdata(13, tx_msg, 0);
dwt_writetxfctrl(13, 0, 0);
So this should create messages with a rather high precision interval.
The transmitter is running permanently with an intermessage interval of 10ms.
On another node the receiver is started and reports the incomming messages like this:
[code]/* Receive callback (called by DW ISR function @dwt_isr) */
static void rx_ok_cb(const dwt_cb_data_t *cb_data)
{
static tdoa_message_t recv_msg;
a_callback_was_called = TRUE;
callback_status = cb_data->status;
read_rxdata(&recv_msg, cb_data->datalength);
chprintf(out, "%d, %d, %s\n", recv_msg.anchor_id, recv_msg.superframe_no,
uint64_to_string(get_rx_timestamp()));
valid_rx_counter++;
}[/code]
The receiver loop is:
[code]for (; {
dwt_rxenable(DWT_START_RX_IMMEDIATE);
resume_on_dwm1000();
if (messages > 0) {
messages--;
if (messages == 0)
break;
}
}[/code]
This works mostly as expected, but analyzing the data (took 100000 samples of th rx timestamp) shows a pretty strange
picture:
There are quite dramatic changes in deviation whenever the receiver is started, which go down to a certain (low) level after about 20-60s.
The noise floor is quite low (units are in mm @ speed of light):