Using same pin as MCPWM output and PCNT input on ESP32-S3
Posted: Mon Nov 28, 2022 12:07 pm
Hi
We are developing a custom PCB where we have to control 4 TMC2209 (with STEP and DIR signals)
For our applications we want to use MCPWM for generating the PULSE and DIR signals (se are already able to do that setting internal register as specified in the technical reference manual)
We are using the esp-idf APIs (4.4.3) only for setting up pins and basic configuration, then we are using register for the configurations because APIs do not have the flexbility/configurations that we need for the pulse configuration
Now we are able to generate the PULSE and DIR signal using MCPWM, but we want to count the number of pulses that have been generated: the idea was to use the PCNT (one for each MCPWM) to count the raising edges
Our problems is that using the esp-idf APIs the GPIOs can be EITHER configured as output for the MCPWM OR input for the PCNT
We want to use the GPIOMatrix in the ESP32-S3 to have the actual pin as output of the MCPWM and then route/loopback that same output to the input of the PCNT
How is this possible?
Can you help us?
Thanks,
Luca
We are developing a custom PCB where we have to control 4 TMC2209 (with STEP and DIR signals)
For our applications we want to use MCPWM for generating the PULSE and DIR signals (se are already able to do that setting internal register as specified in the technical reference manual)
We are using the esp-idf APIs (4.4.3) only for setting up pins and basic configuration, then we are using register for the configurations because APIs do not have the flexbility/configurations that we need for the pulse configuration
Now we are able to generate the PULSE and DIR signal using MCPWM, but we want to count the number of pulses that have been generated: the idea was to use the PCNT (one for each MCPWM) to count the raising edges
Our problems is that using the esp-idf APIs the GPIOs can be EITHER configured as output for the MCPWM OR input for the PCNT
We want to use the GPIOMatrix in the ESP32-S3 to have the actual pin as output of the MCPWM and then route/loopback that same output to the input of the PCNT
How is this possible?
Can you help us?
Thanks,
Luca