Hi,
I'm trying to understand all the timers in ESP8266 RTOS SDK. When I used the PWM library, it caused my esp-homekit clients to disconnect. Nothing in the debug logs, they just dropped connections. Perhaps an issue with secure connections, perhaps an issue with Wi-Fi (although the ESP stays connected to the AP). People are successfully using PWM with FRC1 alongside esp-homekit, so this WDEV TSF0 interrupt must be causing an issue.
Doing some research, I have found;
[*] FreeRTOS System Tick uses CCOUNT and the CCOMPARE0(TIMER0) timer. Initialised in freertos/port/esp8266/os_cpu_a.S
[*] FreeRTOS Timers (xTimerCreate) uses this System Tick (defaults to 10ms ticks; 100Hz)
[*] FRC1 is available to the user via the hw_timer library
[*] PWM uses WDEV TSF0 Interrupt (??). Initialised in startup.c user_init_entry()
ESP32 up until 4.1 used FRC2 for their high resolution hardware timer library esp-timer. This allowed timers to be created that had shorter times than the System Tick.
Looking at ESP8266 RTOS SDK, the esp-timer library seems to just be a wrapper for FreeRTOS Timers; so it isn't using FRC2.
So;
[*] What is this WDEV TSF0 interrupt? Does it affect Wi-Fi or secure connections? Where is the documentation for it?
[*] What is FRC2 used for in ESP8266 RTOS SDK? It is exposed in esp-open-rtos and in the esp-idf sdk, but nothing in the ESP8266 RTOS SDK exposes it.
Timers (CCOMPARE0, FRC1, FRC2, WDEV TSF0)?
Re: Timers (CCOMPARE0, FRC1, FRC2, WDEV TSF0)?
Postby mriksman » Thu Apr 23, 2020 12:32 am
Also, the KCONFIG has the following;
However, when CONFIG_ESP8266_TIME_SYSCALL is defined in time.c, it uses esp_timer_get_time(). This function uses soc_get_ccount() function, which returns the CCOUNT register.
How is that related to FRC1?
Code: Select all
choice ESP8266_TIME_SYSCALL
prompt "Timers used for gettimeofday function"
default ESP8266_TIME_SYSCALL_USE_FRC1
help
This setting defines which hardware timers are used to
implement 'gettimeofday' and 'time' functions in C library.
- If high-resolution timer is used, gettimeofday will
provide time at microsecond resolution.
Time will not be preserved when going into deep sleep mode.
- If no timers are used, gettimeofday and time functions
return -1 and set errno to ENOSYS.
However, when CONFIG_ESP8266_TIME_SYSCALL is defined in time.c, it uses esp_timer_get_time(). This function uses soc_get_ccount() function, which returns the CCOUNT register.
Code: Select all
int64_t esp_timer_get_time(void) {
extern uint64_t g_esp_os_us;
return (int64_t)(g_esp_os_us + soc_get_ccount() / g_esp_ticks_per_us);
}
How is that related to FRC1?
Who is online
Users browsing this forum: No registered users and 259 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.