Problems with using PCNT.

Microzod
Posts: 2
Joined: Mon Sep 16, 2019 1:26 pm

Problems with using PCNT.

Postby Microzod » Sun Jun 15, 2025 10:14 pm

Hello.

I am trying to make use of the PCNT module, in my code I have two libraries that each use PCNT, they work just fine when I test them separated but once put into the same sketch one of the libraries stop working.

Is there any known issues with using driver/pulse_cnt.h?

FYI, I am using an esp32-s3 and all in all my sketch is trying to utilize 3 of 4 pcnt units.

The first library is a publicly available library called RotaryEncoderPCNT

Regards

horace99
Posts: 35
Joined: Mon Oct 14, 2024 10:38 am

Re: Problems with using PCNT.

Postby horace99 » Fri Jun 20, 2025 6:23 pm

I have used the RotaryEncoderPCNT library for reading a QEI encoder module without problems
what is the other library?

could you implement a program using the two libraries which demonstrates the problem?

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: Problems with using PCNT.

Postby lbernstone » Sun Jun 22, 2025 6:43 pm

The linked library is properly keeping track of the units used. Perhaps the other one isn't. Try switching the order of initialization.

Microzod
Posts: 2
Joined: Mon Sep 16, 2019 1:26 pm

Re: Problems with using PCNT.

Postby Microzod » Tue Oct 14, 2025 10:54 pm

I think it has something to do with keeping track of which units that are available or not, in the end I solved this by taking that rotary encoder library code and combining it with my own code. It is a really messy solution but at least everything works when I set up everything from within a single class instance.

Who is online

Users browsing this forum: No registered users and 2 guests