Coincidences Counter (two pulse sources)

Status
Not open for further replies.

AbYaSSer6

New member
Hello everybody,
I'm using Teensy 3.6, Arduino IDE.

First of all, A coincidence happens when detecting pulses from two different sources, in a time window of let's say 5 ns, we see a rising edge on both pulse sources.

I am trying to count coincidences coming from two different pulse sources, my main question is, can I get to count pulses coming of two different sources using Teensy 3.6?

I started using Teensy recently so I'm using the simplest code to count pulses but it is valid for only one pulse source:

Code:
#include <FreqCount.h>

void setup() {
  Serial.begin(57600);
  FreqCount.begin(1000);
}

void loop() {
  if (FreqCount.available()) {
    unsigned long count = FreqCount.read();
    Serial.println(count);
  }
}

Any suggestions?

Thanks
 
Tighter timing than ~17 ns (one cycle of F_BUS at 60 MHz) probably isn't practical. If you absolutely need 5 ns, you're probably going to need a FPGA or other special hardware.

For timers on Teensy 3.6, you probably want to start with the FreqMeasureMulti library. The bad news is you will definitely need to edit the library code. The good news is most of that editing will amount to just deleting stuff. FreqMeasureMulti captures timestamps when the edges occur. It extends the 16 timer to 32 bits, then subtracts each timestamp from the previous, to get the elapsed time. For this, you can get rid of all that processing and just put the raw 16 bit timestamps in the queue, to be read by the main program. They're captured from the same timer, so if you get 2 readings that are identical or differ by just 1 count, then they occurred at nearly the same time.

But again, remember the timers clock from F_BUS (60 MHz), not F_CPU (180 MHz). It is possible to attempt overclocking F_BUS, if you edit kinetis.h. See the comments in that file. However, even with overclocking, getting to 5 ns precision probably isn't achievable on Teensy 3.6. One or two cycles of F_BUS is probably as good as you can do.
 
Thanks for answering me.

The thing is, I bought the Teensy 3.6 based thinking that I can work it on 240 MHz frequency which is enough for 5 ns speed. Which is at least what I need because I will be counting photons and they come at around this time window.
So what is F_BUS and how does it differ from F_CPU (What do they do)?
And if I wanted to get an FPGA for the same job, is the clock frequency the thing I should be looking at or what?

I'll try to play with FreqMeasureMulti library to see how far I can get it to work.

Big fan of your work btw, keep it up!
 
Thanks for answering me.

The thing is, I bought the Teensy 3.6 based thinking that I can work it on 240 MHz frequency which is enough for 5 ns speed.

? you would have 1 cycle ? A CPU can not do much with 1(one) cycle. And the periphals (on Teensy, clocked by F_BUS) are slower than the cpu.
You need fast external hardware such as flipflops & counters, or a FPGA.
 
Status
Not open for further replies.
Back
Top