Teensy 4.0 timer

Status
Not open for further replies.
friends how do i set the timer counter of this teensy 4 device to work with 1 ns precision

Thank you very much in advance for your very important help.
 
first of all thanks for your interest manitou

I thoroughly examined the page but could not find an answer to my question


my question is very simple


How can I configure the teensy 4 device with 600mhz 64 bit timer to 500mhz 64 bit

so I want to set the timer to 500mhz


so I can get 1 ns precision


How is it possible if it is possible?


In theory it seems possible that its processor 600 mhz 64 bit


I ask you again but again


I just needed the hardware internal time counter 500mhz configuration setting


thank you very much in advance
 
Sorry, I am not sure anyone has a simple full answer for you. You might have to do your own homework.

Sometimes the best answer is to look at the reference datasheet, which you can download from the PJRC website: https://www.pjrc.com/teensy/datasheets.html

That is timers are typically 32 bits... So how to get 64 bits? you may have a couple of options. Have an overflow interrupt, which increments a counter, which you combine with the current value to get your 64 bits.

Or as mentioned on the mentioned thread, you may be able to chain two timers to each other. But as mentioned I am not sure how many have tried it, except I believe @manitou has an example sketch that may do it, as he mentioned on that other thread.

Likewise @luni - had some example code that might work on that again mentioned thread.

As for how to get a hardware timer to run at 500mhz, I am not sure.
If it were me, I might look at some of the stuff that @luni did for the library: https://github.com/luni64/TeensyTimerTool

Otherwise you would need to go through the different timer subsystems and see if they can be configured in a way that works for you, without screwing other stuff you may also need.

Example if you look at the GPT timer, you will find that there are a few different hardware clocks that can be mapped into this sub-system. I usually go to the CCM chapter to the CCM Clock tree which in my PDF is about page 1072 and not far from top right of screen you will see where GPT/PIT timer (base clock can be defined).
And you will see there are at least 4 different clocks that can feed into this, which is also mentioned in the clocks section (51.4) of the GPT chapter P3078.
And with most of these are are options for pre/post divisors. Which are set insome of the CCM registers and in this tree you can see how some of those setting will effect other systems as well.

Now if you can configure one of these clocks to work for you, you can then configure the actual clock registers to do counting...

Or more likely you might look at PIT timers, which again I believe uses the same clocks sources as GPT, although maybe it can also count by IP bus, by some divisor (1, 2, 4, ...) ...

But it also has cascade stuff...

So as I mentioned, I am not sure anyone has a simple answer for you. And again I would probably start off looking at the stuff @luni and @manitou have done and was mentioned in that other thread.

But good luck, and hopefully you will find a good answer and post it.
 
dear KurtE, first of all, thank you very much for your interest.
the subject is very, very complicated
I examined all the documents you directed
the hardware timer seems to run at 528mhz 32-bit
but how do we configure and run
they didn't give any idea about
to produce such a high quality top segment product and not to open all its functions to users and
limiting a device of this quality to the same functions as lower segment devices
it didn't make any sense

What I am doing with arduino uno I can't do more with this device except hardware like ethernet usb



Now what's the need after I can't use my question 600 mhz processor 32 bit timer 64 bit memory


T = 1 / f
T = 1 / (500 * 10 ^ 6 Hz)

T = 2 ns

all that is necessary to me

very disappointing for me
 
I need to measure the elapsed time between two processes with a nano-second precision
600mhz processor 32-bit timer 64-bit floating point wow look at how good the technology looks but it's got zero
 
Again everything is available to the end user. Nothing of the processor is hidden from you. Except maybe not all possible IO pins are routed out.

And again @luni gave a simple example sketch on using the cycle time counter to give some function like Nanos....
And again you give no details on how long are these processes run. If under about 7 seconds, than you can simply read that register at start and end to process and compute...
But again this is in 600mhz so you would need to translate. Or you could run the processor at different speed...

Also his library along with the WIKI associated with it can configure things.

Good luck.
 
thank you so much

I have to start the timer when any digital input is high, and when another digital input is high, I will turn it off and look at the time in between, but this will be nano seconds


If you have an idea of ​​how I can do this, it will never exceed 7 seconds, can you give me a way?
 
thank you so much

I have to start the timer when any digital input is high, and when another digital input is high, I will turn it off and look at the time in between, but this will be nano seconds


If you have an idea of ​​how I can do this, it will never exceed 7 seconds, can you give me a way?

untested pseudo code
Code:
uint32_t t1,t2,cycles;
if pin1 HIGH  then t1 = ARM_DWT_CYCCNT;
...
if pin2 HIGH then  t2 = ARM_DWT_CYCCNT;
cycles = t2 -t1;
cycles is ticks of 600 MHz system clock ... bout 1.66 ns per tick
 
many thanks to all the friends who helped
When we compare the values ​​with the oscilloscope, 3.32 ns is delayed.
what could be the reason for this delay
Is the digital input pins reading speed equal to the clock speed ?
digital inputs react to the same duration since the minimum clock speed is 1.66 ns. ?
more precisely, when a voltage is applied to a digital input, it can understand the presence of this voltage with a minimum clock speed of 1.66 ns. ?


Do not look at my fault I'm a little beginner I'm trying to learn


many thanks in advance for your tolerance and help
 
Status
Not open for further replies.
Back
Top