Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: count pulse problem with pulse resolution tennsy3.6

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Posts
    5

    count pulse problem with pulse resolution tennsy3.6

    hello all i'm new in this field
    if there is any unfit please tell me and i'll improve
    Can someone help me do some quick test or prove the pulse resoultion of teensy 3.6
    in my case i need to detect a pulse width 10 ns and it is an irregular pulse
    Thanks for your comments.
    godredrain

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Probably won't work.

    For interrupts, the minimum pulse width is 50 ns. See page 18 in the datasheet, "General Swithing Specifications"

    https://www.nxp.com/docs/en/data-she...4M180SF5V2.pdf

    The timers run from only 60 MHz (F_BUS), so it's doubtful a 10 ns pulse would work for input capture.
    Last edited by Theremingenieur; 09-14-2018 at 10:05 AM. Reason: Fixed typo from 50ms to 50ns

  3. #3
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    If it's about that 10ns pulse just triggering an interrupt, an external mono flop could help for signal conditioning. But if it's about precise measuring the duty cycle of pulses in the 10ns range, no Teensy will do that.

    All just blind guessing around since the @godredrain didn't give enough details and precisions about what he wants to achieve and what he already tried.

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Posts
    5
    @paul so there is no way to improve in this case?(ex.can i add some timer by myself?)
    @theremingenieur sorry i didnt explain clearly. The picture is what the pulse i want to detect
    now i'm using Oscilloscope to detect but i want to use some board to replace it so i survey to the teensy.
    Click image for larger version. 

Name:	PMT count.png 
Views:	8 
Size:	43.7 KB 
ID:	14734

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    If it‘s just about detecting if such a pulse has happened or not and for example triggering an interrupt or DMA transfer from that, or just incrementing a counter, if the Teensy has not to analyze the pulse in detail, and if you can be sure that the pulses do not happen more often than 1/100ns, a solution could most probably be found.

  6. #6
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    193
    Its an interesting problem to count very high speed pulses, such as photon arrival at a photomultiplier tube. I have just been reading the MC10E137 chip spec (PLCC-28 device).

    This is a very high speed (2 GHz) 8 bit ripple counter which might possibly be used to "front end" a Teensy as a 10 MHz counter. Each count bit is available as an output, so if the experiment had a "start and stop" time interval, you could enable/disable the count - then use Teensy digital inputs to inspect the "remainder" in the MC10E137, and add to the Teensy "more significant" counted bits.

    (Note - ECL to TTL logic levels would be involved).
    Last edited by TelephoneBill; 09-15-2018 at 11:28 AM.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    If the time between pulses is more than about 200 ns, you could add a flip-flop circuit to help Teensy run an interrupt. For example, this chip might work.

    https://www.digikey.com/product-deta...X74DR2GOSCT-ND

    Connect the Qn (inverted) signal to the D input, and your short pulse to the CLK pin. Connect the Sn and Cn pins high, so the part isn't forced high or low. Connect either of the Q output to an interrupt pin on the Teensy. Configure the interrupt for CHANGE. Set the interrupt to highest priority, so you're not "blind" when the USB interrupt is running.

    When the pulses happen, the flip-flop will toggle. Since you're detecting either low-to-high or high-to-low, you'll get an interrupt for every pulse. Inside the interrupt, increment a 32 bit volatile variable. In your main program, just read it and print. Maybe store a prior copy and only do stuff when the count actually changes.

    However, this scheme is limited to how quickly interrupts can run. If you get another pulse too soon, the you'll miss it.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Another option would be to use this circuit with the FreqCount library. But this will give you half the count, since only rising edges are captured. Pulses very close together could be handled well, so maybe half the total count is worth capturing (half of) many pulses if they come rapidly.

    Normally FreqCount is used to convert the counts to frequency during the last gate interval. But you could pretty easily edit the code to instead accumulate the counts and print that info, rather than converting to frequency. This approach also has the downside that you get a result at the end of a gate interval, rather than very quickly after the pulse occurs. The minimum interval for FreqCount is 1 ms (at least using the code as-is... other intervals could be implemented with direct access to the timers).

  9. #9
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    Actually, we haven’t yet got any information about how often these very short pulses happen... So, everything is blind guessing. I’d really prefer if @godredrain would tell us more about the source of these pulses and how often or at which frequency these happen. From the oscilloscope picture, we can just guess that the whole pulse story is at least around 50ns before the next event happens.

  10. #10
    Junior Member
    Join Date
    Sep 2018
    Posts
    5
    thanks for everyone's recommend.
    Sorry for the bad explain and didint get the point.
    Actually Im doing PMT pulse counting.
    My PMT counting head is hamamtsu H10682-110.( https://www.hamamatsu.com/jp/en/prod...110/index.html )
    Click image for larger version. 

Name:	h10682-110.PNG 
Views:	8 
Size:	88.4 KB 
ID:	14740
    my case is when the PMT detect the photon it will give a pulse with a pulse width 10ns and +4.4V pulse height
    the pulse-pair resolution 20ns(the pulse is about 20ns between pulse with pulse)
    i need to count in the gate time (ex: 1s) to count how many pulse there is
    so is that good for FreqCount library in teeny?

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    20ns corresponds to 50 MHz. That could still work on a Teensy 3.6 although it’s somewhat close to the limits. Just try it out, using a resistive voltage divider, making sure that the peak voltage at the Teensy’s input will not exceed 3.3V.
    In case you find that the result is not reliable, you might still add a RF pre-divider IC as they are used in RF frequency counters. But one step after the other.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •