Page 1 of 1

Phase Shift of PWM output & Faulty behaviour below 10 Hz

Posted: Thu Apr 11, 2019 5:07 pm
by fungo16
Dear users,

I have been using the ESP32-WROOM 32 Devkit V1 and ESP32 IDF for many projects but now reached the point where I
need some help. Usually, I am using the MCPWM unit to generate PWM. Now, I would like to phase
shift two channels (A & B) with same frequencies (0 - 35 Hz) and duty cycle (50%) by 25%. I know that there might be limitations
due to the timer but maybe there is a workaround (sync, deadtime) that can achieve the desired result.

The second issue is related to stable PWM frequencies below 10 Hz. The corresponding output frequency is coarsely factor 3 higher. Above 10 Hz everything is fine.

Thank you very much!

Re: Phase Shift of PWM output & Faulty behaviour below 10 Hz

Posted: Fri Apr 12, 2019 3:54 am
by WiFive
https://github.com/espressif/esp-idf/issues/2255

For phase shift have one channel in count up mode and one channel in count up/down mode?

Re: Phase Shift of PWM output & Faulty behaviour below 10 Hz

Posted: Fri Apr 12, 2019 6:33 pm
by fungo16
Thank you for your answer.

The link to the issues was very helpful to solve the frequency problem.

Regarding the phase shift, I would highly appreciate to maintain a maximum
number of PWM outputs. Thus, a solution - if possible - using only one timer
would be awesome.

Re: Phase Shift of PWM output & Faulty behaviour below 10 Hz

Posted: Sun Apr 14, 2019 8:59 pm
by fungo16
I spent a few hours today to assess my issue and I think for the optimize implementation I
have to write my own driver.

As a workaround for now:

Is somebody aware of how to start two MCPWM timers with a delay in between to generate the phaseshift ?