I’ve been working with the DecaRange RTLS project with TREK 1000 nodes. I had some problems when using dwt_loadopsettabfromotp. Here is the body of the function:
uint16 reg = ((ops_sel << OTP_SF_OPS_SEL_SHFT) &OTP_SF_OPS_SEL_MASK) | OTP_SF_OPS_KICK; // Select defined OPS table and trigger its loading
// Set up clocks
_dwt_enableclocks(FORCE_LDE);
dwt_write16bitoffsetreg(OTP_IF_ID, OTP_SF, reg);
// Default clocks (ENABLE_ALL_SEQ)
_dwt_enableclocks(ENABLE_ALL_SEQ);
My first question is why this function is writing 16 bits while the User manual mentions that the length of the OTP_SF sub-register is 8.
Secondly, When I read the value of OTP_SF after the dwt_write16bitoffsetreg function call, I figured out that the first two bits are not modified. According to the value of reg, the first bit of OTP_SF sub-register should be set to 1 so the device will load the parameters from OPS.
I used dwt_read16bitoffsetreg(OTP_IF_ID, OTP_SF) to get the value of OTP_SF sub-register. I was wondering if the dwt_loadopsettabfromotp was executed correctly.