@Amani , I also need to measure frequency using an M5 Stack Core 2. I was looking at your code and wondering if you ever solved this problem? I see that you're using a counter that's incremented in an interrupt handler. How do you get the frequency from that?
The way I understand Micro Python interrupts is that they're soft and give you jitter of some milliseconds, like over 2. Because the M5 Stack UIFlow runs on top of Micro Python, it does not seem likely that interrupts with adequate resolution are possible. You'll be lucky to measure a 500Hz signal.
But I'm very interested to hear if you came up with a solution.
I'm planning to solve this problem with a frequency to voltage converter. TI makes a low voltage part, LM331. The output is a voltage proportional to frequency that can be input to an ADC pin. Here's a link to the datasheet, https://www.ti.com/lit/ds/symlink/lm331.pdf
I don't see another way to solve this problem using an M5 Stack. I'm hoping you found one that you can tell me about.
Thanks