Need help with delayed TX value UUS to DWT_TIME please

I have ported the Decawave Api across to a new processor and t appears to be running. The TAG sends ok and ANCHOR receives but I keep getting a HPDWARN flag fromt Register 0x0f:03.

My questions are:

  1. Could this mainly be due to inter-digit gaps in SPI packet increasing processing time?
  2. Can I find out how much the time is out - ie time needed for TX delay compared to time available?
  3. Is it recommended to alter the TX delay time or best to implement something like the DMA on SPI?

Here is the part of code affected. Ret always returns an error and when I set breakpoint in “dwt_startTx()” I see HPDWARN flag is always set.

poll_rx_ts = get_rx_timestamp_u64();
resp_tx_time = (poll_rx_ts + (POLL_RX_TO_RESP_TX_DLY_UUS * UUS_TO_DWT_TIME)) >> 8;
dwt_setdelayedtrxtime(resp_tx_time);

            resp_tx_ts = (((uint64)(resp_tx_time & 0xFFFFFFFEUL)) << 8) + TX_ANT_DLY;
            resp_msg_set_ts(&tx_resp_msg[RESP_MSG_POLL_RX_TS_IDX], poll_rx_ts);
            resp_msg_set_ts(&tx_resp_msg[RESP_MSG_RESP_TX_TS_IDX], resp_tx_ts);

            tx_resp_msg[ALL_MSG_SN_IDX] = frame_seq_nb;
            dwt_writetxdata(sizeof(tx_resp_msg), tx_resp_msg, 0); /* Zero offset in TX buffer. */
            dwt_writetxfctrl(sizeof(tx_resp_msg), 0, 1); /* Zero offset in TX buffer, ranging. */
            ret = dwt_starttx(DWT_START_TX_DELAYED);

Hi,
Please check APS022 page 14 where it describes what your issue might well be. eg a HPDWARN Your TX is late and you’d need to modify timings for your HW/system so that you do not get the LATE event.
Also study the section 3 on Message Transmission in the user manual where HPDWARN is described in much more depth.

Regards ,
/Leo

Thanks Leo,
I understand there is not enough time left to send the reply by the time the code gets to the TX point.

It appears the issue is the SPI routine taking too long. I see I could make the delay time longer to prevent the flag but I would rather have things working as quickly as possible.
However, as a quick test I will increase the delay and check the reply gets transmitted to make sure the rest of the code is functional.