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?