hi,
I’ve done a simple test about dwm1001 data transmission time using dwm1001-dev board, the result surprises me as it cost much time in wating for SYS_STATUS_TXFRS, which I think should at most spend a few tens of milliseconds(< 30us), but it actually spends ~130us. I’ve no idea what’s happening, can somebody give me some tips.
Below is the main code part (from example ex_01a_simple_tx
):
- Init
static dwt_config_t config = { 5, /* Channel number. */ DWT_PRF_64M, /* Pulse repetition frequency. */ DWT_PLEN_64, /* Preamble length. Used in TX only. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ 10, /* TX preamble code. Used in TX only. */ 10, /* RX preamble code. Used in RX only. */ 1, /* 0 to use standard SFD, 1 to use non-standard SFD. */ DWT_BR_6M8, /* Data rate. */ DWT_PHRMODE_STD, /* PHY header mode. */ 65 /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */ };
- data generation:
char msg[12] = … // fixed length, 12 Bytes, includes src/dst addresses and FCS
- sending:
for( ; ; ) { ... ret = dwt_starttx(DWT_START_TX_IMMEDIATE); time1 <- dwt_readsystime(); // timepoint 1, start while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS)) { }; // This costs about 130us! time2 <- dwt_readsystime(); // timepoint 2, end ... }
I think time2-time1
should be approximate ~20us (12Bytes * 8 / 6.8Mbps + SHR time), but in my dwm1001-dev board, it equals to 130us, is this normal behavior, and if so, how can DW1000 achieve 6.8Mbps data rate?
thanks!