New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to use Rotary_encoder_example (IDFGH-5105) #6889
Comments
GPIO10 and GPIO11 on ESP32 are used by SPI flash by default, please refer to datasheet and |
Hello, I have read the io_mux_reg.h file, but I don't quite understand it.First I want to know if 10 and 11 can be modified to be used as encoders.Secondly, if possible, how to modify it? |
Hi @zsjlovestudy GPIO11 is |
Hello, could you please tell me if there are any other pins like 11 pins? Because I need to specify the pin to PWM and encoder at present. |
The following GPIOs are used by SPI Flash by default: #define SPI_CLK_GPIO_NUM 6
#define SPI_CS0_GPIO_NUM 11
#define SPI_Q_GPIO_NUM 7
#define SPI_D_GPIO_NUM 8
#define SPI_WP_GPIO_NUM 10
#define SPI_HD_GPIO_NUM 9 |
In order to create multiple encoder instances the // register interrupt handler
switch(pcnt_isr_service_install(0))
{
case ESP_OK:
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGI(TAG, "pcnt isr already installed");
break;
default:
ROTARY_CHECK(1==0, "install isr service failed", err, ESP_FAIL);
} Does anyone want a pull request for something like this? Is this component going to be an "official" component one day? |
Hi @camrbuss yes, the issue you found is correct. The interrupt is shared by PCNT channels, it should be installed only once.
We don't have a plan to raise the level of this example component, but we're working on new PCNT driver APIs to make that peripheral more flexible, especially for encoders use cases. |
Fix the issue mentioned when using two or more encoders. Modify PCNT_CTRL_GND_IO to avoid the affect of USB JTAG(origin pin 19 is used for USB D-). Update esp32c3. peripherals.ld and docs for esp32s3. Closes #6889
Because I used pins 10 and 11 on the PCB , when I changed the GPIO pins in the example, there was an error.
I need to use four rotary encoders simultaneously。However, after I made four copies according to the template of the sample code, he made a mistake of interrupting the repeated registration. Could you please tell me how to solve this?
When I comment out the code that breaks registration, I can run all three at once, except for pins 10 and 11.
The text was updated successfully, but these errors were encountered: