Hi. Experts.
UWB settings are as follows.
dwt_config_t uwb_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. /
DWT_SFD_DW_8, / 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_EXT, / 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_OFF, / STS disabled /
DWT_STS_LEN_64, / STS length see allowed values in Enum dwt_sts_lengths_e /
DWT_PDOA_M0 / PDOA mode off */
};
I changed the setting to DWT_PHRMODE_EXT to transmit about 300 bytes, and the size of the SPIT/RX buffer is 200 (idatabuf, itempbuf), so I wrote the function as below and ran it once.
void send_large_data(uint8_t *data, uint16_t length)
{
const uint16_t max_chunk_size = 190; // < 200(spi t/rx buffer size)
uint16_t bytes_remaining = length;
uint16_t offset = 0;
while (bytes_remaining > 0)
{
uint16_t chunk_size = (bytes_remaining > max_chunk_size) ? max_chunk_size : bytes_remaining;
dwt_writetxdata(chunk_size, &data[offset], offset);
bytes_remaining -= chunk_size;
offset += chunk_size;
}
dwt_writetxfctrl(length + FCS_LEN, 0, 1);
dwt_starttx(DWT_START_TX_IMMEDIATE | DWT_RESPONSE_EXPECTED);
}
However, there are two transmission interrupts on the sending side and two reception interrupts on the receiving side.
(It is being sent twice at a very short interval (seems to be less than 50ms). When you try to send 300 bytes of data, the first one sends normal data, and the second one sends the same 200 bytes out of 300 bytes.)
What’s the reason?
How do I fix this? I’ve been holding onto this for two days now.
(If I simply buffer and send the entire data using dwt_writexdata, it will only be sent once, but abnormal data will be sent.)
I’ll link what I’ve referenced.
Best Regards.