2

I'm trying to input the frequency of a 3.3V square wave on a GPIO pin as a program feedback parameter. The input frequency range would be 1000 to 100,000 Hz and data polling would happen at 30 Hz. Its important to minimize processor overhead.

We got the dedicated PWM pin on the GPIO working fine. Is there a similar dedicated frequency counting / timer GPIO pin that could do the low overhead counting?

Thanks Jim

5

There is no hardware support for frequency counting via the Pi gpios. You will have to monitor the gpios in software.

Given your upper end is 100kHz I suspect my pigpio library is most likely to give reliable results. pigpio works by sampling and doesn't have the significant overhead involved with interrupts at these frequencies.

Two frequency count methods are given in these examples.

  • Thanks Steve. Too bad on the dedicated pin. I'm aiming to control the averaging window and measurement precision and counting over a period seems the best way if it is possible. Ill check out your library. ..And use an external chip if needed. -Jim – Jim Sears Dec 5 '14 at 1:46
  • 2
    Steve, your library is awesome! – Jim Sears Dec 8 '14 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.