Closed kszere closed 5 years ago
Try the new Ticker library (nearly the same as on ESP8266). Ticker. Works fine for me with more than 4 timers/tickers.
I also use all four hardware timers without issues. If you need more timers the Ticker library referenced above is good for that. For my use case I don't know that Ticker is suitable, as part of each invocation of the timer the period changes based on external factors.
@beegee-tokyo Thanks for "Ticker". How use 4 HW Timers without crash? In my code, functions take something 2 sec and also something 10 sec. It crash my ESP.
From my understanding (I might be wrong), you should use the timers to set variables and act upon it in the main loop so the delay will be in main loop not timers functions.
With hardware timers you must do whatever tasks you want to do quickly, the shorter amount of time in the ISR the better. As @sansillusion suggests, setting variables or toggling a GPIO pin is about the max you should really be doing. In my case I am triggering the various hardware timers at ~58uS, ~116uS, ~98uS or 196uS. The time between ISR invocations depends on the data being converted to a digital signal on a pair of GPIO pins.
@kszere what I do is
I made a kind of tutorial Using the multitasking capabilities of the ESP32 / FreeRTOS
Hello , is it possible to go any higher that 40mhz with the timer resolution? I need about 50 mhz to time an intrerupt.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
This stale issue has been automatically closed. Thank you for your contributions.
Hardware:
Board: TTGO LORA SX1278 ESP32 0.96 OLED 16 Mt bytes (128 Mt bit) 433Mhz for arduino Core Installation/update date: 07/03/2018 IDE name: Atom + PlatformIO Upload Speed: 115200
Description:
Sketch:
https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_multitimer/ESP32_multitimer.ino