Timer

[中文]


What should I pay attention to when using the HW timer interrupt with ESP8266?

  • Please refer to ESP8266 Technical Reference Manual regarding the related APIs.

  • Typically, the hardware interrupt callback function should finish as quickly as possible and be placed in IRAM to avoid the impact of Cache being disabled. For RTOS SDK, add the linker attribute IRAM_ATTR before the function name.


How to set interrupt priority for timers?

  • The esp_timer, using ESP32 as an example, allows you to configure the interrupt priority by modifying the configuration item CONFIG_ESP_TIMER_INTERRUPT_LEVEL in Menuconfig.

  • The General Purpose Timer allows setting interrupt priority when registering the interrupt service function. For details, please refer to the API description of timer_isr_callback_add.


How to improve the timeliness of interrupt response in gptimer?

Put the interrupt function and the corresponding callback into the IRAM.