Page 1 of 1

esp32 PCNT counter

Posted: Mon Dec 02, 2024 10:28 am
by dwayne99
I am attempting to read a PWM bit signal from a WS2812B. Is it possible for me to use the PCNT module on the esp32 for me to count the pulses and obtain the frequency of the signal. The Ws2812B bit signal frequency when read using the oscilloscope is around 800Khz and the pulse high time is around 400-800ns. We are currently using an esp32-c3 but planning to move to an esp32 with the PCNT module if the need arises.

Re: esp32 PCNT counter

Posted: Wed Dec 04, 2024 8:25 am
by MicroController
Yes, the PCNT can count the pulses and you can calculate the frequency from that count.
Do you really only want the frequency, or rather the actual data, i.e. the pulse widths?
You can also use the RMT to capture the pulses, but you'll need 32 bits of RAM for every WS2812B bit captured.