mariocaptain
Member
Hi all,
I am running 9 functions inside an Interrupt Service Routine (ISR) which is triggered 140 times/second (i.e. 140Hz) on a Teensy 3.1. These functions have to do with calculating variables and parameters and don't have anything to do with peripherals.
I am turning pin 0 on an off in order to measure the relative time required to run these functions by observing on an oscilloscope.
My aim is to increase the frequency of the ISR from 140Hz to as much as possible so these functions are called as frequently as possible.
When I set the Teensy to run at 24Mhz, I see a duty cycle of 78% on the scope, and when I increase it to 72Mhz, the duty cycle is 74% - just very little improvement which kind of surprises me, I thought it should be 78%/3 = 26% or something like that. This is the main reason I am switching from Arduino UNO running at 16Mhz to Teensy for this application. I was able to run this at 70Hz on the UNO, so for an MCU that is almost 10x faster, and just 2x improvement it's disappointing.
My question is why so little improvement?
I have never run the Teensy overclocked, so the side question is if I overclock to 96Mhz or 120Mhz, should there be any concerns (aside from the possible increase in heat) since I have heard somewhere that overclocking may affect interrupts. Has anyone overclocked to 96Mhz or 120Mhz in some serious application?
Any comment is really appreciated.
Dave
I am running 9 functions inside an Interrupt Service Routine (ISR) which is triggered 140 times/second (i.e. 140Hz) on a Teensy 3.1. These functions have to do with calculating variables and parameters and don't have anything to do with peripherals.
I am turning pin 0 on an off in order to measure the relative time required to run these functions by observing on an oscilloscope.
Code:
void timerCallback0() {
//cli();
digitalWrite(0, HIGH); //to measure the execution time of these routines with an oscilloscope
Function1();
Function2();
Function3();
Function4();
Function5();
Function6();
Function7();
Function8();
Function9();
digitalWrite(0, LOW);
//sei();
}
My aim is to increase the frequency of the ISR from 140Hz to as much as possible so these functions are called as frequently as possible.
When I set the Teensy to run at 24Mhz, I see a duty cycle of 78% on the scope, and when I increase it to 72Mhz, the duty cycle is 74% - just very little improvement which kind of surprises me, I thought it should be 78%/3 = 26% or something like that. This is the main reason I am switching from Arduino UNO running at 16Mhz to Teensy for this application. I was able to run this at 70Hz on the UNO, so for an MCU that is almost 10x faster, and just 2x improvement it's disappointing.
My question is why so little improvement?
I have never run the Teensy overclocked, so the side question is if I overclock to 96Mhz or 120Mhz, should there be any concerns (aside from the possible increase in heat) since I have heard somewhere that overclocking may affect interrupts. Has anyone overclocked to 96Mhz or 120Mhz in some serious application?
Any comment is really appreciated.
Dave
Last edited: