ESP32 faster interrupts on timer

For general Flowcode discussion that does not belong in the other sections.
Post Reply
MJU20
Posts: 237
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 75 times
Been thanked: 50 times

ESP32 faster interrupts on timer

Post 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?

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ESP32 faster interrupts on timer

Post 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.

MJU20
Posts: 237
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 75 times
Been thanked: 50 times

Re: ESP32 faster interrupts on timer

Post 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!

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ESP32 faster interrupts on timer

Post 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 85 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.

MJU20
Posts: 237
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 75 times
Been thanked: 50 times

Re: ESP32 faster interrupts on timer

Post 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.

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ESP32 faster interrupts on timer

Post 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.

MJU20
Posts: 237
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 75 times
Been thanked: 50 times

Re: ESP32 faster interrupts on timer

Post 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.

Post Reply