Measure frequency of a square wave input without PRU?

Any suggestion on how to measure the frequency of a square wave input?

Signal would be 3kHz or less. The goal is to use the appropriate AM3358 peripherals from the ARM core, not the PRU.

The eCAP peripheral comes to mind but I’m not sure it that would be appropriate for this use case.

For reference, the question comes from this github issue:
https://github.com/adafruit/adafruit-beaglebone-io-python/issues/204#issuecomment-347415768

Any suggestion on how to measure the frequency of a square wave input?

Signal would be 3kHz or less. The goal is to use the appropriate AM3358 peripherals from the ARM core, not the PRU.

The eCAP peripheral comes to mind but I’m not sure it that would be appropriate for this use case.

If you know it is a square wave input, the eCAP pulse counting would work well.

I wrote a C program that uses inotify to watch the gpioxx/value file. It can see changes up to 20kHz, so 3kHz should be no problem at all.

As far as I can tell there is no support in the Debian kernel for the eCAP feature. You can use eCAP to output a PWM signal but I can’t find anything that supports the eCAP capture feature.