I'm looking for in essence two outputs: a 50% PWM output, and the output of a logic inverter. It's for driving a motor driver IC. Unfortunately, I can't use an actual logic inverter IC. Is there a way to do this all in software? Does anyone know how this can be done? Thanks!
On an UNO, Nano (classic), Mega, Leonrdo... you would use a timer to genertae PWM. Set the 'A' channel to regular PWM and set the 'B' channel to inverted PWM.
With a ESP32 just program the MCPWM API to produce 2 PWM signals with a phased shifted output.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/mcpwm.html
Why? Do you need dead time?
Here, the 3-phase Wokwi examples have dead time insertion.
The library uses LEDC control, however MCPWM control as mentioned by @Idahowalker might be the only compatible method (for ESP32) depending on the specifications of your hardware and control circuit.
When working with only 2 signals on the ESP32, the timing will be synchronized if using several PWM channels on the same hardware timer.
In this example, inverted PWM and dead time could be achieved:
Awesome! Thanks everyone!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.