TX timestamp is Not Correct After Wake Up

Hi all,
After waking up dw1000, first tx-timestamp reading returns incorrect value. Least significant byte returns always 0.

Here is the wake up funct:

int uwb_wakeup_on_cs(void){
if(dwt_readdevid() != DWT_DEVICE_ID)
{
    spi_reset_cs();
    k_msleep(1);
    spi_set_cs();
    k_msleep(5);
}

if(dwt_readdevid() != DWT_DEVICE_ID)
{
   return DWT_ERROR; 
}

return DWT_SUCCESS;

}

Here is sleep conf:

dwt_configuresleep(DWT_PRESRV_SLEEP | DWT_LOADOPSET | DWT_CONFIG, 0x05);

Here is wake-up process:

        g_return = uwb_wakeup_on_cs();

        meeblue_turn_on_led(LED2_GREEN_PIN);

        init_frame[FRAME_SN_INDEX] = index;
        msg_set_ts(&init_frame[TWR_INIT_FRAME_GUID_INDEX], (uint64_t)tag_guid);
        msg_set_uint16(&init_frame[TWR_INIT_FRAME_RESERVED_SLOT_INDEX], TIME_TO_SLOT(g_poll_time));
        
        uwb_transmit_msg(sizeof(init_frame), init_frame, (DWT_START_TX_IMMEDIATE | DWT_RESPONSE_EXPECTED));

        k_usleep(RESPONSE_INITIAL_DELAY + (CLUSTER_SIZE * RESPONSE_DELAY_US));

        init_tx_ts = get_tx_timestamp_u64();

Any Tx timestamp has zeroed 9 least significant bits - this is how the chip works. The actual transmission happens precisely at this time.

With “DWT_START_TX_IMMEDIATE” i can see least byte changes and twr results are correct. When i put sleep then wake ic up, Results become incorrect.

I found my issue on user guide section “7.2.26 Register file: 0x18 – Transmitter Antenna Delay”

This register is not preserved during SLEEP or DEEPSLEEP and so needs reprogramming after a
wakeup event in order to obtain the correct adjustment of the TX_STAMP.
1 Like