Reading high speed frequency

I’m trying to use an argon to read an encoder. I dont need full quadrature, just a single input is fine. I need to extract how fast its clocking. It could go up to 10 or 20khz which is a bit faster the the the software times can handle for poling.

Is there a high speed counter (timer with external clock is fine) I can read and clear periodically?

I read the ADC DMA which I can do and process each buffer periodically but scanning through the whole thing could take too long.

I need to do this on 2 clocking inputs with independent sources.

Application in short: I need to read in 2 clocking inputs, save a ratio of speed (teach button while at stead state), and then open a relay if the ratio of these clocking inputs differ from the ratio by more then 10%-ish.

For something like that you'd rather use interrupts which measures the micros() or System.ticks() between two triggers.

@ScriffR How many Input Capture pins does the Boron MCU have, and is there an easy way to set them up?

I could eliminate an entire separate microcontroller I am using alongside Boron, for frequency measurement just like the OP, if this is possible on Boron.

External interrupts are not sufficient because of latency.

The low-level MCU Input Capture feature will actually store the exact nanoseconds of the edge into a buffer, then trigger an interrupt that will eventually get serviced where you grab that timestamp and store it in a ring buffer.

Teensy’s FreqMeasureMulti library is priceless for this purpose and is why I am not using a 100% Particle solution.

Is there a way do to this on Boron?

What kind of signal are you intending to test. For the OP's 20kHz (50µs period) 15µs latency should not be an issue.

For really low-level stuff I'd defer to @rickkas7.
He has whipped up this

So he'll already be into the depths of the nRF52840 feature set.