Comments on: ESP32 with FreeRTOS: Software Timers/Timer Interrupts (Arduino IDE) https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 12 Jan 2026 01:12:06 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Robin Graham https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1149555 Mon, 12 Jan 2026 01:12:06 +0000 https://randomnerdtutorials.com/?p=175393#comment-1149555 In reply to Sara Santos.

Thanks for your explanation Sara. I hadn’t properly understood the distinction between timer and hardware interrupts. I confess I didn’t really understand what you meant by a “regular” function at first, but having dug a little deeper since reading your reply I now realise that timers run under a timer daemon which is a standard task (albeit with priority (config_MAX_PRIORITIES – 1) i.e. the highest possible) and are therefore managed by the RTOS scheduler. In contrast, hardware ISRs can’t be pre-empted under any circumstances.
Thanks again and also for for the many other RandomNerd tutorials which (unlike some of other stuff out there) are clear and accurate.
Robin

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1145299 Fri, 02 Jan 2026 14:19:20 +0000 https://randomnerdtutorials.com/?p=175393#comment-1145299 In reply to Robin.

Hi.
I’m not sure if I can explain this clearly.
But, basically, FreeRTOS timers are time-based and not executed in a “real” interrupt context. They are basically “regular” functions that run after a timer runs out.
The hardware interrupts are like “real” CPU interrupts. The ISRs must be placed in the internal IRAM, so that the board doesn’t crash in case the flash memory is not accessible at the moment the interrupt occurs.

Regards,
Sara

]]>
By: Robin https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1144214 Tue, 30 Dec 2025 22:18:42 +0000 https://randomnerdtutorials.com/?p=175393#comment-1144214 Thanks for this clear tutorial – I’m trying to get to grips with FreeRTOS and it was really useful. Might even buy the eBook!
However I’m confused by the distinction between timer interrupts, which are handled by what you call ‘callback’ functions and hardware interrupts ( a button press in this tutorial) which are handled by ‘Interrupt Service Routines (ISRs)’. The former are defined in the style void fooCallback() but the latter as void IRAM_ATTR fooISR(). Can you comment on the distinction? I know what IRAM_ATTR does, but don’t understand why it isn’t necessary with timer interrupts.
Regards, Robin

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1138963 Wed, 17 Dec 2025 11:54:54 +0000 https://randomnerdtutorials.com/?p=175393#comment-1138963 In reply to Xavier R.

Hi.
I haven’t played with the settings of the config file, so I can’t tell.
I think you can modify those parameters without issues, as long as you adjust with realistic values. But, you’ll have to try to find out.

Regards,
Sara

]]>
By: Xavier R https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1138894 Wed, 17 Dec 2025 05:31:37 +0000 https://randomnerdtutorials.com/?p=175393#comment-1138894 Hi,

Is that possible that we can modify the FreeRTOSConfig.h file in order to adapte it to our needs, without braking anything? And if so, where do we put it? In our sketch directory?

For example, out of the box the framework only allows to have 10 timers, maybe this number is good enough for many applications:

// original:
#define CONFIG_FREERTOS_TIMER_QUEUE_LENGTH 10

But suppose that I need to use 20:

// mine:
#define CONFIG_FREERTOS_TIMER_QUEUE_LENGTH 20

Another example is the length for the task’s name:

#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16

What if I need (or want) the length’s name to be 80?

How dangerous is to modify such file in this kind of scenarios?

It’s worth to mention that you don’t need to reserve 10 KBytes of RAM to blink a LED (even for the examples):

#define CONFIG_FREERTOS_IDLE_TASK_STACKSIZE 1024

Greetings!

]]>
By: Tony Contrada https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1129745 Mon, 01 Dec 2025 19:11:49 +0000 https://randomnerdtutorials.com/?p=175393#comment-1129745 In reply to Sara Santos.

Hopefully you may have some examples soon.

Thank you!

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1127938 Thu, 27 Nov 2025 11:24:11 +0000 https://randomnerdtutorials.com/?p=175393#comment-1127938 In reply to Tony Contrada.

Hi.
No.
We don’t have any examples for Watchdog timers at the moment.
Regards,
Sara

]]>
By: Tony Contrada https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1127758 Wed, 26 Nov 2025 18:46:50 +0000 https://randomnerdtutorials.com/?p=175393#comment-1127758 Is there an example using the Watchdog Timers?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1127159 Mon, 24 Nov 2025 15:42:08 +0000 https://randomnerdtutorials.com/?p=175393#comment-1127159 In reply to Peter Lörne.

Hi.
Yes. You can create more than two timers.
Regards,
Sara

]]>
By: Peter Lörne https://randomnerdtutorials.com/esp32-freertos-software-timers-interrupts/#comment-1127133 Mon, 24 Nov 2025 12:53:51 +0000 https://randomnerdtutorials.com/?p=175393#comment-1127133 Very interesting and informative article that puts my brain to work. My question, you gave an example of 2 LEDs flashing at different frequencies. Is it possible to create more timers than two? My thoughts are to read 5 humidity sensors that will each control a solenoid valve. Regards Peter Lörne

]]>