Using PCNT to Measure Frequency on Two Inputs
Using PCNT to Measure Frequency on Two Inputs
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.
Re: Using PCNT to Measure Frequency on Two Inputs
I have the same use case/requirement and have taken also your example (as well as the original source of your example) and facing the same problem. Only the second input GPIO 12 is working.
I also have not yet understdood what need to be implemented twice to measure two frequencies.
I found this code which I think works with two counters and threshold) but not frequence measure, just counter and threshholds for counters.
Maybe this could lead us to a combined solution of dual PCT + frquency measurement?
https://github.com/mikegofton/ESP32PulseCounter
I also have not yet understdood what need to be implemented twice to measure two frequencies.
I found this code which I think works with two counters and threshold) but not frequence measure, just counter and threshholds for counters.
Maybe this could lead us to a combined solution of dual PCT + frquency measurement?
https://github.com/mikegofton/ESP32PulseCounter
Re: Using PCNT to Measure Frequency on Two Inputs
Hi,
Has anyone been able to run 2 counters at frequencies higher than 10kHz?
For me, multPulses on the second unit is always 0?
Has anyone been able to run 2 counters at frequencies higher than 10kHz?
For me, multPulses on the second unit is always 0?
Who is online
Users browsing this forum: No registered users and 84 guests