I'm trying to generate an ePWM, from simulink to external oscilloscope. I have LAUNCHXL-F28379D TI card. I will use Vdd voltage (3.3V or 5V for adc input) for ADC input. How should i connect ePWM and ADC blocks to generate PWM from this buck converter. I tried many configurations but I couldn't. Would you help me?

 Accepted Answer

Darshan Pandit
Darshan Pandit on 24 Jul 2023
Hi Mehmet,
I've answered a similar question in the first post below. Request you to kindly go through it.
Also, you have a hybrid model of plant and control system. PWM requires the model to be prepared for code generation. This needs separation betwen plant and controller. You may refer to that in fourth link mentioned below.
There are also more ways of getting things done. One of them is external mode. Refer to last three links, if you'd like to explore more on this.
For more details for ePWM block, see:
  1. https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/880817/launchxl-f28379d-how-to-implement-space-vector-generator-to-epwm-module-using-simulink
  2. https://in.mathworks.com/matlabcentral/answers/438952-how-does-the-ti-c2000-epwm-block-work
  3. https://in.mathworks.com/help/supportpkg/texasinstrumentsc2000/ref/c280xc2802xc2803xc2805xc2806xc2833xc2834xf28m3xf2807xf2837xdf2837xsf2838xf28004xf28002xf28003xepwm.html?s_tid=doc_ta
For more details for DC DC Buck converter design using ePWM blocks, see:
  1. https://in.mathworks.com/help/ti-c2000/ug/dc-dc-buck-converter.html
  2. https://in.mathworks.com/company/events/webinars/upcoming/modeling-and-generating-code-for-a-dc-dc-buck-converter-4123100.html
Using external mode:
  1. https://in.mathworks.com/help/ti-c2000/ug/signal-monitoring-paramter-tune-xcp-on-serial.html
  2. https://in.mathworks.com/help/ti-c2000/ug/code-verification-externalmode.html
  3. https://in.mathworks.com/matlabcentral/answers/751504-overview-executing-ti-c2000-simulink-models-in-external-mode
Hope this helps.
Have a good day.

14 Comments

Thank you so much Mr. Pandit. But I have a trouble now. How can I fix this problem?
Darshan Pandit
Darshan Pandit on 25 Jul 2023
Edited: Darshan Pandit on 25 Jul 2023
hi mehmet,
It appears that you're trying to use the example and running into mixing up two debugging functionality:
  1. Fast Serial Data Monitoring
  2. External mode
The example uses first method to communicate with LaunchXL-f28379d, and using external model is another thing altogether. Assuming you only have one USB-Serial cable connecting the system with LaunchXL-F28379d, it isn't possible to use both methods.
I'd suggest using only one method for communicating with the target device. The specific error listed above can be resolved by any one of the followiong ways:
  1. Comment out fast serial data monitoring
  2. Avoid external mode, if you're using serial communication.
  3. Use different SCI module for external mode, if you have more than one cables connecting system to LaunchXL-F28379d.
Hope this helps.
Have a good day.
Hi Mr. Pandit. I have this problem when I am trying to do the example that you sent (https://in.mathworks.com/help/ti-c2000/ug/dc-dc-buck-converter.html). Isn't there a cable for launchpad? In this example, just SCI A module used. When I change them, for example; SCI transmit=SCI B, SCI receive=SCI C, the problem is solving but if I do build&deploy and after that monitoring&tune, T(period) is becoming 0 and it is not increasing. Is this about this problem or Do I have something else problem? Do I have to Buck Converter card in order to take EPWM?
Darshan Pandit
Darshan Pandit on 25 Jul 2023
Edited: Darshan Pandit on 25 Jul 2023
Hi mehmet,
I guess you're clicking the wrong button for code generation.
The example uses SCI_A for communication. It does not use external mode. You may be trying out "monitor & tune" button that uses external mode.
To do this correctly, please goto Hardware tab in Simulink Toolstrip and click "Build, Deploy and Start" button. It should build and download the code into target device.
Then you can use the companion host model to communicate with the device.
there is also a video explanation of old version of this example.
Hope this may be helpful.
https://in.mathworks.com/matlabcentral/fileexchange/61420-dc-dc-buck-converter-example
Hi Mr. Pandit I cannot take ePWM even if I just click "Build, Deploy and Start". Do I have to a real buck converter card to take ePWM?
Hi Mehmet,
You do not need buck converter card, but LaunchXL-F28379d is needed to generate ePWM.
You'd have to prepare the model for code generation. The process is simple and illustrated in this video.
Once you're ready, you can use the ePWM block instead of GPIO used in the video for LED blinking.
you may also use any of the examples available on the following page:
If the problem persists, please contact us and we have a team who would be glad to help you out.
Hope this helps.
Have a good day.
Thank you so much Mr. Pandit. I had a com port problem, that was the main problem but solved now. I had a ePWM now thanks to you and examples. But I want to create my host model. Would you suggest me a source to do an host model?
Hi mehmet,
You can get started from the available host models in various examples of C2000 Microcontroller Blockset. Once you get familiar with the functionality, you may create your own.
Hi again Mr. Pandit. I am working on this example "https://in.mathworks.com/help/ti-c2000/ug/dc-dc-buck-converter.html" and I have a quesiton. I am trying to take EPWM by using a potentiometer but my PWM is not changing when ı turn it. PWM is becoming just 1 and 0. I am using the same channel with voltage (ADCINC4). What is my problem? Would you help me?
the only change is adcinc4 was previously connected to 1.6 volts now it is connected to the middle leg of the potentiometer
Hi Mehmet,
Modifications you've made changes the system and ePWM duty cycle would either goto 100% or 0% depending upon the voltage that appears as feedback from middle leg of potentiometer to ADCINC4.
You can simulate this situation in the model even before generating code. Also, there seems to be some confusion. Without more details and changes of your model and it is difficult to comment further.
please click here and contact us with more details so our team can help you out. Mention this thread to speed up the process.
Hope this helps.
Have a good day.
Thank you so much Mr. Pandit. I did your suggestion now. I want to show you my problem with pictures. I am just moving jumpers from voltage divider circuit to potentiometer's legs. Width, lenght ex. are not changing.
Great. Please click here and contact us with these and more details so our team can help you out. Mention this thread to speed up the process.
Hope this helps.
Have a good day.

Sign in to comment.

More Answers (0)

Communities

More Answers in the  Power Electronics Control

Products

Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!