espressif: Fixes for Quadrature Encoder mode of PCNT peripheral#16391
Merged
acassis merged 5 commits intoapache:masterfrom May 16, 2025
Merged
espressif: Fixes for Quadrature Encoder mode of PCNT peripheral#16391acassis merged 5 commits intoapache:masterfrom
acassis merged 5 commits intoapache:masterfrom
Conversation
…ture Encoder mode Only 2 pins are needed in this mode for both channels. The wiring is such that Edge and Level pins are cross-connected for both channels.
1 task
acassis
previously approved these changes
May 15, 2025
xiaoxiang781216
previously approved these changes
May 15, 2025
Remove SENSORS and SENSORS_QENCODER as it is selected by ESP_PCNT_AS_QE.
Contributor
|
The changes enabled @matiamic to use and test QENC support after breakages of original @Vajnar contribution by Espressif changes. It would be nice if Espressif people can check and approve changes (@tmedicci, @eren-terzioglu). I have not found time to test the code myself so I am not sure if I should approve changes. I could do that on base of @matiamic report and his demonstration at the meeting at the university. |
Contributor
|
Let it to be tested internally in our internal CI. Don't merge it yet, please. |
acassis
approved these changes
May 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After changes in PR #15079, there are few issues/inconsistencies which this PR addresses. Namely:
CONFIG_ESP_PCNT_U0_CH1_EDGE_PINandCONFIG_ESP_PCNT_U0_CH1_LEVEL_PINin code.ESP_PCNT_Ux_QEin Kconfig. For unit number zero, ifESP_PCNT_U0_QEis enabled, thenCONFIG_ESP_PCNT_U0_CH0_LEVEL_PIN=-1andCONFIG_ESP_PCNT_U0_CH1_EDGE_PIN=-1. Whereas for units 1,2 and 3 the respective Kconfig values are not defined at all when in Quadrature Encoder mode (i.e. there is noCONFIG_ESP_PCNT_U1_CH0_LEVEL_PINneitherCONFIG_ESP_PCNT_U1_CH1_EDGE_PIN)SENSORS_QENCODER.Impact
ESP_PCNT_Ux_QEand definition ofCONFIG_ESP_PCNT_Ux_CH0_LEVEL_PINandCONFIG_ESP_PCNT_Ux_CH1_EDGE_PINis unified across all PCNT units.depends on !ESP_PCNT_Ux_QEand thus are not defined. We fix this by correctly assigning the 2 pins in crossed fashion in code when in Quadrature Encoder mode.Testing
Testing was performed on esp32c6-devkitc and
qencoderdefconfig (in case of 2nd issue modified to include more units).