Teensy 4 measuring period between two interrupts, with nanosecond resolution

Status
Not open for further replies.
Hello...

FIRST QUESTION:

I need to measure the timing between a sync pulse and several other pulses, to a resolution of a couple of nanoseconds. In the ESP32 there is ESP.getCycleCount(), which gives the number of processor cycles that have elapsed since the processor turned on. With a 240MHz clock, the ESP32 returned a period with a 4.167ns resolution, give or take a few cycles for interrupt service, reading etc.

Is there something similar in the Teensy 4.0 that can yield timing resolution to a couple of nanoseconds. Mine is a ToF application using radio pulses, something like a radar...

SECOND QUESTION:

Using the Teensyduino, is there a way to overclock the Teensy 4.0? If so, how and to what frequency can it be clocked safely at say, an ambient temperature of 25 deg Celsius?

Thank you.
 
Yes T_3.x and T4 have ARM_DWT_CYCCNT, see this post : pjrc.com/threads/58321-micros()-within-Interrupt-possible. Using that ARM_DWT_CYCCNT takes only about 3 cycles as it is a register read - not a function.

As far as MCU Speed - with current IDE and TeensyDuino 1.48 installed the 'Tools / CPU Speed' menu item has options for setting CPU speed at compile time. It can also be adjusted at runtime with set_arm_clock().

Selecting under 900 MHz can generally run without adding a fan or heatsink where ambient air and setup allows heat removal - the menu notes at speeds above that 'Cooling Required'.

There is a tempmonGetTemp() call that can be made to get the internal measured CPU temp that will give some degree of feedback - but overclocking without enough cooling will hang/harm the processor at times before that number goes as high as it will function normally at lower speeds.
 
Teensy can measure time interval with timer resolution which equals to F_BUS. It's 150MHz on Teensy 4.0 with 600MHz clock, 200MHz when overclocked to 800MHz, 250MHz when overclocked to 1GHz (with good heatsink).
There is a useful library, FrequencyMeasure (FrequencyMeasureMulti). I'm not sure if they already ported to Teensy 4.0 or not.

But if using of external IC via SPI is acceptable, you can try specialized time-of-fly (time-to-digital) converter IC.
E.g. TDC2700 has 55 picoseconds resolution or even better if averaging is used.
 
Yes T_3.x and T4 have ARM_DWT_CYCCNT, see this post : pjrc.com/threads/58321-micros()-within-Interrupt-possible. Using that ARM_DWT_CYCCNT takes only about 3 cycles as it is a register read - not a function.

As far as MCU Speed - with current IDE and TeensyDuino 1.48 installed the 'Tools / CPU Speed' menu item has options for setting CPU speed at compile time. It can also be adjusted at runtime with set_arm_clock().

Selecting under 900 MHz can generally run without adding a fan or heatsink where ambient air and setup allows heat removal - the menu notes at speeds above that 'Cooling Required'.

There is a tempmonGetTemp() call that can be made to get the internal measured CPU temp that will give some degree of feedback - but overclocking without enough cooling will hang/harm the processor at times before that number goes as high as it will function normally at lower speeds.

Thank you, @defragster. very valuable info...
 
Teensy can measure time interval with timer resolution which equals to F_BUS. It's 150MHz on Teensy 4.0 with 600MHz clock, 200MHz when overclocked to 800MHz, 250MHz when overclocked to 1GHz (with good heatsink).
There is a useful library, FrequencyMeasure (FrequencyMeasureMulti). I'm not sure if they already ported to Teensy 4.0 or not.

But if using of external IC via SPI is acceptable, you can try specialized time-of-fly (time-to-digital) converter IC.
E.g. TDC2700 has 55 picoseconds resolution or even better if averaging is used.

Thank you @Vadim, specially for the TDC2700!
 
Status
Not open for further replies.
Back
Top