Modifying TI C2000 ePWM block output
4 次查看(过去 30 天)
显示 更早的评论
Is it is possible to modify an ePWM output to do additional calculations before sending a PWM signal to GPIOs.
For example, I would one of the switches to switch using the following logic:

or

For the first three signals am sending a reference to a PWM block, but my fourth PWM signal is calculated as a combination of the first three PWM signals, i.e. forth signals does not have a reference.
1 个评论
Omar Shouman
2022-10-25
Hello Mike,
I want to do the same thing. I was wondering if you were able to do it or find an alternative. That would be very helpful.
Thank you for your time.
Kind Regards,
Omar
回答(1 个)
Samar
2025-4-25
As per my understanding, you are trying to implement a custom logic for ePWM4. You are trying to derive the output of the fourth ePWM as a logical combination of the other three ePWMs.
This is possible, the following steps should be followed to implement this logic:
- Use “ePWM” blocks to generate the first three PWM signals with the usual workflow.
- To know the logical state of a digital pin, use the “Digital Input” block. Connect one block to each of the GPIO pins. Make sure the sample time is same for corresponding ePWM and Digital input block.
- For the above function you can also use “From Workspace”.
- To apply logical operation, use the “Logical Operator” block. Select the desired logical operation and feed the three ePWM signals to it.
- The output from this logical operator block is the desired ePWM4. Since this is not from a reference signal, there is no requirement of using another ePWM block. Instead, we can directly connect this output to drive a “Digital Output” block.
There are some points to be noted:
- Make sure that the PWM frequency of the three base signals is sufficient for the logic to make sense at GPIO level.
- The sample rate of the logical operation block should be high enough to capture all the transitions.
Refer the screenshot given below to understand the step-by-step procedure mentioned above. Here I have tried to create 4th ePWM by taking XOR operation of the existing three ePWMs.

- Refer this website to understand the generation of an ePWM waveform for a custom frequency and duty cycle: www.mathworks.com/help/ti-c2000/ug/epwm-waveform-example.html
- Refer this link to understand about “Digital Input” block: www.mathworks.com/help/releases/R2022b/supportpkg/texasinstrumentsc2000/ref/c280xc2802xc2803xc2805xc2806xc2833xc2834xf28m3xf2807xf2837xdf2837xsf2838xf2838xm4f28004xf28002xf28003xgpiodigitalinput.html
- To know more about “From Workspace” block: www.mathworks.com/help/releases/R2022b/simulink/slref/fromworkspace.html
- For understanding about “Logical Operator” block refer this link: www.mathworks.com/help/releases/R2022b/simulink/slref/logicaloperator.html
- Refer this link to understand about “Digital Output” block: www.mathworks.com/help/releases/R2022b/supportpkg/texasinstrumentsc2000/ref/c280xc2802xc2803xc2805xc2806xc2833xc2834xf28m3xf2807xf2837xdf2837xsf2838xf2838xm4f28004xf28002xf28003xgpiodigitaloutput.html
I hope this helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!