I'm working on a project where I want to integrate AoA into the DS TWR templates provided in the DW3000 api.
My hardware is made up of the QM33120WDK1 Ultra-Wideband (UWB) Transceiver Development Kit, which has two NRF52840 boards (one AoA mounted).
I am using the AoA mounted board as the responder and the non AoA mounted board as the initiator.
This is the config I used:
dwt_config_t config= { 5, /* Channel number. */ DWT_PLEN_128, /* Preamble length. Used in TX only. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ 9, /* TX preamble code. Used in TX only. */ 9, /* RX preamble code. Used in RX only. */ 3, /* 0 to use standard 8 symbol SFD, 1 to use non-standard 8 symbol, 2 for non-standard 16 symbol SFD and 3 for 4z 8 symbol SDF type */ DWT_BR_6M8, /* Data rate. */ DWT_PHRMODE_STD, /* PHY header mode. */ DWT_PHRRATE_STD, /* PHY header rate. */ (128 + 1 + 8 - 8), /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */ DWT_STS_MODE_1, /* Mode 1 STS enabled */ DWT_STS_LEN_128, /* (STS length in blocks of 8) - 1*/ DWT_PDOA_M3 /* PDOA mode off */ };
After the STS quality check on response in the initiator, I print out the PDoA ad AoA values and find that despite the two boards being completely stationary, the values fluctuate.
Debugger Output:
DS TWR INIT v1.0
PDOA val = 88, Degrees = 2.461928
PDOA val = 199, Degrees = 5.567314
PDOA val = -32, Degrees = -0.895247
PDOA val = 40, Degrees = 1.119058
PDOA val = -349, Degrees = -9.763783
PDOA val = 247, Degrees = 6.910184
PDOA val = -491, Degrees = -13.736439
PDOA val = 729, Degrees = 20.394835
PDOA val = 94, Degrees = 2.629787
PDOA val = 403, Degrees = 11.274511
PDOA val = -56, Degrees = -1.566681
PDOA val = 88, Degrees = 2.461928
PDOA val = 143, Degrees = 4.000633
Main AoA Code:
/* A frame has been received, read it into the local buffer. */ frame_len = dwt_getframelength(0); if (frame_len <= sizeof(rx_buffer)) { dwt_readrxdata(rx_buffer, frame_len, 0); /* Check that the frame is the expected response from the companion "DS TWR responder STS" example. * As the sequence number field of the frame is not relevant, it is cleared to simplify the validation of the frame. */ rx_buffer[ALL_MSG_SN_IDX] = 0; if (memcmp(rx_buffer, rx_resp_msg, ALL_MSG_COMMON_LEN) == 0) { uint32_t final_tx_time; uint64_t poll_tx_ts, resp_rx_ts, final_tx_ts; int ret = DWT_ERROR; //Calculate AOA from the initiator pdoa_val = dwt_readpdoa(); degrees = ((float) pdoa_val / (1<<11)) * 180 / PI; // To log corresponding degrees. sprintf((char *)&pdoa_message_data, "PDOA val = %d, Degrees = %f", pdoa_val, degrees); test_run_info((unsigned char *)&pdoa_message_data);