This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1110: Problem reading all 31 bits of WOR time



I'm trying to read all 32 bits of the WORTIME.  I understand that these don't latch and I need to handle that in software. (I.e. multiple read attempts until a stable read is achieved, etc.)

The problem I'm seeing is that when I set the WORCTL.WOR_RES, it doesn't seem to change the "view" into the 31 bit timer.

The code looks like this:

///////////
// Setup to read the upper 15 bits of the sleep timer
WORCTRL = (WORCTRL & ~WORCTL_WOR_RES) | WORCTL_WOR_RES_32768;

firstReadByte3 = WORTIME1;
firstReadByte2 = WORTIME0;

// Setup to read the lower bits of the sleep timer
WORCTRL = (WORCTRL & ~WORCTL_WOR_RES) | WORCTL_WOR_RES_1;
 firstReadByte1 = WORTIME1;
firstReadByte0 = WORTIME0;
///////////

What I'm seeing is firstReadByte0 == firstReadByte2 and firstReadByte1 == firstReadByte3 every single time.

The data sheet doesn't say that there is any kind of time to wait after setting WOR_RES before WORTIME1/0 is valid ... it sure looks like it's not having any effect.  Is there a way to do this or is it pretty much impossible to get an accurate fix on the full scale value of this timer?

  • Hi

    You must wait 1 tick on the 32k + some cycles before the update takes place.

    I did a test where I added a SW delay of ~ 2 ticks (60 us) after changing WOR_RES and I then got the result I expected.

    BR

    Siri