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

Thread: Success With FreqCount Above 10MHZ on Teensy 3.2

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    3

    Success With FreqCount Above 10MHZ on Teensy 3.2

    I have built the EXACT project documented in the FreqCount tutorial.

    https://www.pjrc.com/teensy/td_libs_FreqCount.html

    I have followed this exactly in every way. I am using it with the same preamp transistor 2N3904 and the same Schmidt trigger. I feed the circuit with a signal generator that is supplying the input to the preamp with about .6 vpp sine wave.

    Except I am using a Teensy 3.2. I would like to use this frequency counter up to about 20 MHZ.

    It works great up until about 10MHZ. After that the readings in the serial monitor begin to show low by a few KHZ. As I move the frequency up to 15MHZ, the readings are low by more - low by close to 12 KHZ. The higher I go, the more they are off.

    I am using a 1000 msec gate time just like in the tutorial.

    I am comparing the readings to 2 other, manufactured, frequency counters that agree with each other.

    Is there something about the input stage that could be limiting my effective max frequency? Shouldn't the Teensy 3.2 permit me to count much higher than 10 MhZ with accuracy?

    What might I be doing incorrectly? Any advice is appreciated.

    Thanks,

    Mark

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,394
    The page indeed says :: FreqCount: best for 1 kHz to 8 MHz (up to 65 MHz with Teensy 3.0 & 3.1)

    Is the simple code in that linked page in use?

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    3
    Yes, this is the code I am using.

    #include <FreqCount.h>

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

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

    Thanks,

    Mark

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,939
    Can your function generator output a 0 to 3V signal? Then you could drive the pin directly.

    That transistor circuit was only tested with the old Teensy 2.0 boards. It may not work well at higher frequency.

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    3
    I am thinking it may be in that input circuit. I will be trying this with a signal from a VFO from a Swan 350 ham transceiver. I think I can get a higher voltage signal from that.

    Thanks,

    Mark

  6. #6
    Can somebody explain frequency counting on the teensy

    Does it use the main processor to do this ? Or is there a part of the processor dedicated to counting ?

    On the arduino typically you use a interrupt, but this causes the main loop to break down at high frequencies

    I want to count 40 khz on 4 channels

  7. #7
    Senior Member
    Join Date
    Feb 2017
    Posts
    279
    Quote Originally Posted by Gadget999 View Post
    Can somebody explain frequency counting on the teensy

    Does it use the main processor to do this ? Or is there a part of the processor dedicated to counting ?

    On the arduino typically you use a interrupt, but this causes the main loop to break down at high frequencies

    I want to count 40 khz on 4 channels
    For that frequency, it looks like FreqCount is recommended. There's a link on the page to github where you can view the code. It uses counter / timer hardware resources on the chip. Which resource depends on which processor you're using. But, all of them have a single dedicated input pin. To have 4 channels, it might be easier to have an external hardware selector.

Tags for this Thread

Posting Permissions

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