Pysense Deepsleep Timer Accuracy
-
Would it be possible to know which clock is used with pysense
go_to_sleep(self,gps=True)
function aftersetup_sleep(self, time_s)
function has been used? I am using Pysense deepsleep on a Lopy4 and the accuracy of the deepsleep timer is terrible. I am talking about 30s error on a 300s interval.Could it be related with Esp32 clock frequency (I really doubt it since pysense disconnects the esp32 on deepsleep)? I have changed that frequency to 80MHz in order to save power.
Thanks,
JuanMa
-
Hi @catalin
Sorry I couldn't answer before. If the esp32 frequency is 160MHz the pysense timer works fine, it only has trouble when the frequency is changed. I am going to measure the error better to see if there is a clear relation between the frequency change and the timer error.
Thanks,
-
Hi,
The clock source for the time interval, set bypytrack.setup_sleep(time_seconds)
is the Pic microcontroler, from Pysense.
But it's adjusted with the ESP32 clock; so if esp32 clock is changed, we could have some big error, indeed.
Could you quickly check if leaving esp32 at 160Mhz, this error persists?
This micropython method makes the calibration between the 2 clocks.
https://github.com/pycom/pycom-libraries/blob/ce0cfa57b06b3ef58a08d98bf7a33c6a7cffa4e2/lib/pycoproc/pycoproc.py#L229
<later edit> but if esp32 clock is 2 times slower, the 300 sec, should transform in ~600sec, not 250sec.