Q1: Is there any errors in the code below? (exec FORCE_SYS_XTI even if no OTP read)
Q2: Why do we need to set clock to XTI when reading OTP? Can’t find this fact in the UM.
int dwt_initialise(int config)
{
…
// NOTE: set system clock to XTI - this is necessary to make sure the values read by _dwt_otpread are reliable
// when not reading from OTP, clocks don’t need to change.
if(!((DWT_DW_WAKE_UP & config) && ((DWT_READ_OTP_TMP | DWT_READ_OTP_BAT | DWT_READ_OTP_LID | DWT_READ_OTP_PID | DWT_DW_WUP_RD_OTPREV)& config)))
{
_dwt_enableclocks(FORCE_SYS_XTI);
}
…
}
Source file: deca_device.c (dw1000_api_rev2p14.zip\dw1000_api_rev2p14_coocox\decadriver)