4 Generate Eight PWM Signals with TCE and WEX
The TCE can generate precise and versatile PWM signals on all four channels and generate complementary waveforms that do no overlap.
The WEX can be configured to extend the four compare channels given by TCE up to eight channels capable of generating a PWM signal.
Below is an example of how to set a TCE and a WEX instance to generate eight complementary PWM signals at 20 kHz with variable duty cycles using the buffering - use the Generate PWM Signals with TCE and WEX section for reference. The signals are in pairs of two without overlapping due to the added dead time, an essential feature in motor control for avoiding the shoot-through current in transistor switching. The update of the compare registers will happen during the compare match interrupts for each channel. In this example, the Fault protection feature is highlighted as well. When a software event is triggered, it emulates a Fault event, and all the signals are driven low, which happens every 1 ms. Configure the WEX for Fault event detection and the EVSYS to generate a software event to do this.
The following two subsections explain how to configure the TCE and WEX peripherals to perform the desired behavior. The first subsection clarifies the TCE and WEX configuring using bare metal code. The second subsection explains the TCE and WEX configuring using MCC Melody. The last subsection contains the results.