What is the maximum hibernate duration for the P2? The prototypes appear to accept system_tick_t (uint32_t) with a granularity of 1sec despite being in msec.
uint32_t 0xFFFF_FFFF => 49.71days, but I don't think that's true.
I have a suspicion the maximum hibernate is less than 1day.
The timer API in the RTL872x SDK takes a uint32_t and a time in milliseconds, which implies a very long sleep duration.
However, basic timers use the 32 kHz peripheral clock. It looks like LPTIM0 - LPTIM3 don't have a prescaler, which implies that the counter might actually be in 32 kHz ticks. This would imply a maximum value of 131,072 seconds or 36 hours, which sort of fits your one day observation.
I do not know this to be the case, and I might have misunderstood the datasheet, but it's plausible.
0x3FF_FFFF would be 67108.863s = 1118.48m = 18.64hr, but I have empirical evidence that contradicts 0x3FF_FFFF as the upper limit.
I have a theory that the maximum is actually 65535000msec = 65535s (0xFFFF sec). I'm running a test to prove that theory now. And I'll post my findings later tonight.
Sleep uses a separate RTC/AON (always-on) timer which is 32kHz based with a max value of 0x3FFFFFFF. So, this should equal to 546 mins or ~9.1 hours.
I missed that additional 0x3FFF_FFFF, so maybe I'm missing something in the calculation. Would you spoon-feed me on how the calculation is made using the 32kHz timer?
Thank you. Yes, timer resolution is in seconds, but the API implies loading in msec, so the maximum value should be divide by 1000 to get the seconds, e.g., calling with 0xFFFF_FFFFmsec = 0x41_8937 sec (4294967sec).
Appreciate the source link. Yes, I agree with the SOCPS_AONTimer() being loaded with a u32 in seconds; however, how does the previous API load msec into a call that uses sec? You cannot guarantee the maximum 0x3FFF_FFFF since the Particle API suggests msec, which would require a divide by 1000.
There's some other kind of calculation that affects the entry into SOCPS_AONTimer()