Tool/software:
I am using the C2000 support package in the matlab simulink. I want a 20khz and 0.5 duty cycle. Hence, I have set the TBPRD at 2500 and CMP value at 1250. I have attached my Algorithm image from ADC to ePWM. For ADCAIN3 the output ePWM1 and ePWM4 are blue and pink waveform. For ADCBIN2 the output ePWM2 and ePWM3 are green and yellow waveform. The switch and sign block are used to control the half cycle of Vac reference voltage/signal. The PWM signal is generated based on the digital representation of the analog value read from the input. I am using transport delay to shift the signal from positive half cycle to the negative half cycle as shown in the image attached. The transport delay is set to 0.05 of the time delay. ePWM1 CAU: clear CAD: set. ePWM4 CAU: set CAD: clear. ePWM2 CAU: clear CAD: set. ePWM3 CAU: set CAD: clear. The deadband supposed to be set at 900ns. I have tried to used the deadband however, the duty cycle/width of the PWM only changes. My problem is the waveform yellow ePWM4 and blue ePWM3 are overlapping. How to fix this issue? How to produce the signal at negative half cycle of Vac reference voltage/signal.
Hello Wan,
When it comes to using C2000 Matlab Simulink feature there are sets of FAQ and common examples that could help you:
Is your duty cycle for yellow and green supposed to be 50 percent? Also are you using up-down or up-count mode for time base counter? If you want to avoid shoot-through of the switches, you should use dead-band submodule. Is using deadband changing your duty cycle to be almost 90 percent like in the picture? Deadband should not modfy duty cycle significantly if everything is set up correctly.
Best regards,
Stevan D.
Actually the duty cycle for those waveform followed the reference Vac signal. I am using up-down count mode. I have used the deadband, It is supposed only involved during rise or fall time of the PWM, however the width or duty cycle of the waveform changes. Or else my algorithm affect the PWM?
What is the EPMWCLK set to in your case? Seems PWM is set correctly it is more probable issue is with your algorithm.
The FPWM for this microcontroller F28379D is 100Mhz. For my EPWMCLKDIV I am using SYSCLKOUT/2. I am thinking of an issue with my algorithm. The transport delay cannot be used in this situation. I have found a function at the GENERAL tab under the synchronization action where the phase value(phase offset value TBPHS) can be specified. Anyhow, i am not sure with the phase offset function. Do you have any idea how to avoid from the PWM overlapping?
PWMs are overlapping because duty cycle is not 50 percent. So, the part that generates wrong duty cycle in your algorithm needs to be corrected. I will loop in Simulink expert so you can ask questions specific to Simulink implementation.
Based on my calculation, since the FPWM for F28379D is 100Mhz, i am using 1 x 1 prescaler. Thus, the TBPRD i got is 2500. For the CMP value is 1250. Thank you for your help Mr Stevan, Hope for any advice from other simulink expertise.
There is a hardware option available as you rightly pointed out - Phase Delay which allows you to configure the phase as per need. Please don't use transport delay in this case. Based on your need, you can configure the phase delay, sync in - sync out signals and the counter mode after sync happens. Please read more on this in time base topic in the device reference manual.
Hi Aditya,
Thank you for replying in this forum. You are suggesting me to use a phase delay hardware instead of using the transport delay?
I would like to control on each phase. Thus, the microcontroller itself cannot control during positive or negative phase?
Yes, I am suggesting to use the phase delay option available within the EPWM block. You can customize the logic based on your need and adjust the phase configuration accordingly.