Hello,
As the topic, I wanna get finest ticks from the system. Currently I can get ticks from FreeRTOS but resolution is not enough. I wonder that we can get something like 'Execution tick count' by some ways.
Thank you!
How the most finest 'tick count' I can get from ESP32 ?
-
- Posts: 5
- Joined: Thu Dec 08, 2016 1:10 pm
Re: How the most finest 'tick count' I can get from ESP32 ?
1. gettimeofday function. With default settings in menuconfig, gives you time at microsecond resolution. Timekeeping continues in deepsleep (but there is a bug in the current master branch which causes time to be reset when going to deep sleep; follow above link for a workaround).
2. CCOUNT CPU register (one on each CPU). Gives you number of CPU cycles since CPU has started. Counts ticks, so doesn't account for CPU frequency changes (not a problem now, but may be once we implement D(V)FS). Counters of the two CPUs are not synchronized in any way, so take care if your task has no CPU affinity.
2. CCOUNT CPU register (one on each CPU). Gives you number of CPU cycles since CPU has started. Counts ticks, so doesn't account for CPU frequency changes (not a problem now, but may be once we implement D(V)FS). Counters of the two CPUs are not synchronized in any way, so take care if your task has no CPU affinity.
Code: Select all
#include "xtensa/core-macros.h"
uint32_t ccount = XTHAL_GET_CCOUNT();
-
- Posts: 5
- Joined: Thu Dec 08, 2016 1:10 pm
Who is online
Users browsing this forum: Gaston1980 and 105 guests