I was working on some play tests with GPIO and realized that in my tests, I didn't need networking so removed those calls. Now my code was no longer working. As I dug deeper, I found that the return from system_get_time() was now constantly returning 0. This call should return the number of microseconds since ESP32 startup. By trial and error, I seem to find that if one does NOT call esp_wifi_init() then the timer does not tick. Is this working as desired? I'm sure we will be fine if that is the case, but I'd like to try and capture those semantics in case someone else downstream has an issue.
Usual caveats apply in that I could easily have messed something up in my tests and this is environment specific to me ... etc etc.
[Solved] system_get_time() does not appear to tick until after esp_wifi_init() is called
[Solved] system_get_time() does not appear to tick until after esp_wifi_init() is called
Last edited by kolban on Mon Nov 07, 2016 5:39 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: system_get_time() does not appear to tick until after esp_wifi_init() is called
Yes, logically it should work either after startup or after system_init. I think this function derives time from internal clock of wifi peripheral. We should change that to use either RTC or another timer.
Re: system_get_time() does not appear to tick until after esp_wifi_init() is called
You can now obtain time at microsecond precision using `gettimeofday` function. It works even when wifi is not enabled.
Who is online
Users browsing this forum: Google [Bot] and 240 guests