pulse_cnt works using GPIO35 but not GPIO25 for input
Posted: Sun Apr 02, 2023 7:56 pm
I've programmed a pulse counter to use gpio35 for counting up and gpio25 for counting down. We are using two optical detector pcbs to drive the input. Counting up on gpio35 works. But counting down does not. GPIO25 out is always high. Its as if the esp-idf is driving the output and I don't know how to turn it off. GPIO35 is an input only without any pullup or pull down resistors and its working as expected. GPIO25 however makes my optical detectors indicate that they are on all the time and the optical detector output can not drive it low. If I short GPIO to ground and connect/disconnect multiple times the counter counts down as it should.
Looking through pcnt.h and pcnt.c it looks like the gpio pins are pulled up and driven with a loopback feature. Since GPIO35 is not an output it works but GPIO25 does not. Is this a bug? Or is there a method or means to change this? I've tried changing the flags in pcnt.h so that the output is not pulled up but then we generate a bunch of errors. I am not driving the levels for chan a nor b. Just using the edges for a and b. With a on GPIO35 to count up and b on GPIO25 to count down always.
I've tried other optical switches on GPIO25 without success. Haven't tried using a transistor to drive the input lower. But the optical switch is a pulled up npn transistor output already and I really don't want to burn out the esp32 wroom ic if its driving the output high.
Looking through pcnt.h and pcnt.c it looks like the gpio pins are pulled up and driven with a loopback feature. Since GPIO35 is not an output it works but GPIO25 does not. Is this a bug? Or is there a method or means to change this? I've tried changing the flags in pcnt.h so that the output is not pulled up but then we generate a bunch of errors. I am not driving the levels for chan a nor b. Just using the edges for a and b. With a on GPIO35 to count up and b on GPIO25 to count down always.
I've tried other optical switches on GPIO25 without success. Haven't tried using a transistor to drive the input lower. But the optical switch is a pulled up npn transistor output already and I really don't want to burn out the esp32 wroom ic if its driving the output high.