Higher ISR frequency than 1MHz on Teensy 3.6

weigu

Member
Hi,

Is there a simple possibility to get a higher interrupt frequency than 1MHz on Teensy 3.6 or Teensy 4.0? I tried the TeensyTimerTool lib (t1.beginPeriodic(ISR_x,1)), but there seems no possibility to set times under 1µs.

Thanks for help.
Guy
 
Hi,

Is there a simple possibility to get a higher interrupt frequency than 1MHz on Teensy 3.6 or Teensy 4.0? I tried the TeensyTimerTool lib (t1.beginPeriodic(ISR_x,1)), but there seems no possibility to set times under 1µs.

Thanks for help.
Guy

The TimerTool timers accept floats as duration:

Code:
  PeriodicTimer t1(TCK);   // or any other timer module

  t1.begin(ISR_x, 0.5);  // 500ns  

  // Or, if you prefer std::chrono literals: 
  t1.begin(ISR_x, 753ns);  // 753ns
  // or
  t1.begin(ISR_x, 0.0002ms) // 200ns  
 // or
  t1.begin(ISR_x, 2.5_MHz)

Edit: The beginPeriodic interface is depreciated and will be removed in the future. Please use PeriodicTimer or OneShotTimer instead...
 
Hi luni,

Thanks for your awesome library. I had tried floats with the MoreTimers example from your library. The code compiled, but I had no signal on my Osci. With PeridicTimer it works now. But the highest frequency I get is about 2.2MHz and not 10MHz as expected.

Code:
void pulse10ns() {
    digitalWriteFast(1, HIGH);
    delayNanoseconds(10);
    digitalWriteFast(1, LOW);
}

void setup() {
    pinMode(1,OUTPUT);
    t1.begin(pulse10ns,   0.1); // 10ns pulse every 100 ns
}

Thanks for your help
 
10MHz is not really feasible. The IMXRT processor needs a lot of time to sync the peripheral bus and the 'main' bus in an interrupt. Using the TCK timers (purely software, no interrupts) you can get some 6MHz, with overclocking probably more. But at those high frequencies the processor is effectively blocked.

If you only want to generate a 10Mhz signal as in your example you can use AnalogWrite which works in hardware without much loading of the processor. I don't remember the max frequency of AnalogWrite but I think 10MHz should be fine.
 
I need the interrupt for a DDS. What about hardware interrupts? Do I have to tweak the register or is there a possibility with the CMSIS interface?
 
The TimerTool IS I would be very surprised if you can do anything reasonable while the processor runs interrupts at 10Mhz.

Agree. Does DDS stand for Direct Digital Synthesizer? You can try generating your waveforms without interrupts in a loop that uses delayNanoseconds() or reads the ARM cycle counter on each pass and takes action at the desired times.
 
Depending on what you output is, I'd think of DMA, perhaps... but to get the timing reliable is not that easy.
 
Haven't used T_3.6 in some time - but overclocked to 256 with 128 MHz F_BUS edit will let it do the best it can - probably not enough?
Code:
C:\T_Drive\Arduino_1.8.16_155\hardware\teensy\avr\cores\teensy3\kinetis.h:
  764  #if (F_CPU == 256000000)
  765   #define F_PLL 256000000
  766:  #ifndef F_BUS
[B]  767:  #define F_BUS 64000000
  768:  //#define F_BUS 128000000  // all the usual overclocking caveats apply...[/B]

A T_4.1 @600 MHz can do over 5 MHz 'fast' interrupts but seems to falls short of 10 MHz before the it overwhelms the processor.
IIRC the pin bus then runs at 150 MHz with 600 MHz T_4.1 - but has _isr overhead where the PORT of pins interrupt is multiplexed and has to be decoded.
OC to 800 MHz not suggested (good cooling/heat sink and likely shorter life) - but would push the F_BUS to 200 MHz and give better response and more cycles to work with?
 
Back
Top