2024-01-28 12:24 AM - edited 2024-01-28 12:26 AM
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
2024-01-28 07:38 PM - edited 2024-01-28 07:40 PM
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.