Re: NRF52 and timing - actual state and what functions to use? #nrf52-pca10040
Dne 06.01.2020 v 18:31 Andy Ross napsal(a):
On 1/5/20 4:30 AM, Martin Kozusky [newsgroups] wrote:is it 1000ms timeout = 33 cycles, or 1ms timeout = 33 cycles? This is acceptable for short-term timeouts.1 - what is the best solution to call my function every 1ms (or willPeriodic k_timer's do not work in fractional ticks, no. If you
When this gets into 2.2, can I use "k_uptime_ticks() / 32768" to get the exact time in seconds?2 - what is the best solution for most precise long-term timeLong term time is kept as a 64 bit count of ticks, so it's not subject
As far as using a different oscillator to drive the timer, that'sOn another project, I would like to be sleeping most of the time to save power and want to be woken by pin interrupt or 1 sec timeout, so it is good idea to have clock in low-power.
BTW: When I enter to sleep by k_sleep(), is there any change in power consumption besides thread being put to sleep? Or do I have to call device_set_power_state(DEVICE_PM_LOW_POWER_STATE) to enter low-power mode? Will I be automaticaly put to DEVICE_PM_ACTIVE_STATE when there is an pin interrupt and is there any way how to get number of ticks I've been in low-power mode since I was woken by pin interrupt? (are ticks also incremented in low-power mode?) (on bare-metal I would set RTC modulo to wake after 1 second, go to low-power and if I got woken earlier by pin interrupt, I would read RTC counter to get the exact time I was sleeping or if I got woken by RTC INT, I would know it was exactly 1 sec, then do some stuff, again setup RTC, go to sleep ... is this even possible with Zephyr and NRF52832? )