Using PCNT to Measure Frequency on Two Inputs
Posted: Wed Feb 23, 2022 7:24 pm
I am using the well established ESP32 Frequency Meter code (https://www.esp32.com/viewtopic.php?t=17018) as a base to modify for measuring the frequency of a second input, but am having some difficulty in processing the second channel. My approach is to use a separate PCNT unit for each input, share the 1 second timer control and accumulate the counts using two interrupts. I may not have the ISR handlers configured correctly. The sample code uses portMUX_TYPE timerMux for synchronizing. Not sure if I need two instances of this or not. I've proven that I can measure frequency on the two chosen inputs, just not together. I've tried using inputs as low as 1 kHz for testing even though the single channel counter will work up to 40 MHz.