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.

Sleep Timer - Confusing comment in datasheet and in software

Other Parts Discussed in Thread: SIMPLICITI

Hello all,

CODE:
You can see the following code in the datasheet, in SimpliciTI software and in other software examples at the init of sleep timer:

char

 

temp = WORTIME0;
while (temp == WORTIME0); // Wait until a positive 32 kHz edge

 

DATASHEET:
The datasheet states: 'Entering PM{0 - 2} and/or updating EVENT0 and has to be aligned to a positive edge on the 32 kHz clock source.'

PROBLEM:
The comment reflects what the datasheet states. But the code does not exactly mean that.
It is only true if the WOR_RES is set to 00. If WOR_RES is set to 11, you are waiting in the while cycle for 1 second not for a 32 kHz clock edge.

Which is true?
A) We have to wait for a 32 kHz edge.
B) We have to wait for a change in WORTIME.

  • Hi Zoltan,

    Alternative A is true, but there are only two ways of checking this. Either through the change in WORTIME (which will vary depending on the resolution) or the use of Watchdog in Timer mode (~2 msec resolution.

    Regards,
    Kjetil