cancel
Showing results for 
Search instead for 
Did you mean: 

Tick OS to Tick LSE Conversion

DS.4
Senior II

Hi

This is a general question regarding entering sleep, so whatever part you know and can explain will benefit greatly.

The questions are much around the function LpTimerStart, which in general converts OS ticks to LSE clock ticks.

 

The number 1e12 ( or 1,000,000,000,000) is used commonly, why is that specific number chosen?

What is "ps" as referred to in CFG_TS_TICK_VAL_PS, time_ps ?

Can you explain the formula :

 

 

#define CFG_TS_TICK_VAL_PS        DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE )

 

 

#define CFG_TS_TICK_VAL_PS DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE )


And this: ( this one is from LpGetElapsedTime)

 

 

  time_ps = (uint64_t)((CFG_TS_TICK_VAL_PS) * (uint64_t)(LpTimerContext.LpTimeLeftOnEntry - LpTimeLeftOnExit));

 

time_ps = (uint64_t)((CFG_TS_TICK_VAL_PS) * (uint64_t)(LpTimerContext.LpTimeLeftOnEntry - LpTimeLeftOnExit));

 

Thanks

1 REPLY 1
TDK
Guru

ps is picoseconds. 1e12 picoseconds in a second. Macro gets the number of picoseconds per LSE tick.

Second definition gets the number of picoseconds left.

If you feel a post has answered your question, please click "Accept as Solution".