Page 1 of 1

ESP32 faster interrupts on timer

Posted: Fri Jan 14, 2022 11:21 pm
by MJU20
Is there a way to have much faster interrupts with the ESP32 then the once I see on timerX?
The shortest I see is to set timerX to 1 millisecond?

Aren't there smaller prescalers for the timers?

Re: ESP32 faster interrupts on timer

Posted: Mon Jan 17, 2022 10:06 am
by BenR
Hello,

What target device are you using and I'll have a go at editing the definition file for you to try and make this possible.

Leigh might have set the limit at milliseconds to aid in the RTOS operation that drives a lot of the ESP32 libraries.

Re: ESP32 faster interrupts on timer

Posted: Wed Jan 19, 2022 11:09 pm
by MJU20
Hello BenR,

I'm using the ESP Wroom 32 at this moment.
If this would become a problem with other functions, this isn't that big issue!

Re: ESP32 faster interrupts on timer

Posted: Fri Jan 21, 2022 12:09 pm
by BenR
Hello,

Ok do you want to have a try with this modified (experimental) definition file and it should add a microsecond option into the timer interrupt for you.

Simply copy the file to here on your file system.
C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\ESP

ESP32_WROOM_32.fcdx
(39.44 KiB) Downloaded 90 times

Let us know how you get on. What I could do is add the option to all definition files but mark the microsecond option as Experimental so if there are problems then we maybe have a clue as to what the problem could be.

Re: ESP32 faster interrupts on timer

Posted: Fri Jan 21, 2022 10:03 pm
by MJU20
Thank you BenR,

This seems to work. :D
I've made a led flasher in microseconds and this is flashing for hours already on my desk.

Re: ESP32 faster interrupts on timer

Posted: Mon Jan 24, 2022 5:19 pm
by BenR
Brilliant, thanks for letting me know. What interrupt rate are you using at the moment?

I've rolled out the change to all the ESP32 definition files now and we can monitor if this new experimental feature is going to cause any unpredicted problems :D

I beleive when Leigh originally did the definitions we were only running the ESP at 80 MHz so now we're at full 240MHz speed it might be much less of an issue.

Re: ESP32 faster interrupts on timer

Posted: Mon Jan 24, 2022 11:19 pm
by MJU20
Last test I've used 250 microseconds to make a 1 sec LED flasher.

But if you want I will test it with a 1 microsec interrupt to make a 1 sec flasher.
If you really want to have the timing I could hook up my logic analyser but that is something that I only can do next weekend.