This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am using MATLAB to create SPWM pulses on ePWM1 and ePWM2. Below is the figure of the model.
The code is flashed correctly and device outputs the PWMs as expected as shown in figure below.
However, if I keep the code running, the pulses start to disappear and I am left with only PWM pulses at the edges as shown in the figure below.
Can anyone please help me understand what's happening and how do I prevent it?
Santosh,
Please find the images below:
MATLAB Model:
Normal PWM:
PWM Dropping/Disappearing:
One more piece of information is that if I restart the controller, it starts working fine.
-Nakul
Nakul,
We will check with MathWorks team for this. But I want to check if you tried any ePWM DriverLib example and check if they behave ok?
Hi,
It looks like an overrun situation. How fast is the model running, i.e sample time?
Try with only one ePWM block and see if you can get it to work always.
That will prove the fact that overrun is occurring. Also try reducing the step time and see if it makes an impact.
We can discuss further once these observations are confirmed.
Regards,
Venkatesh C
Thank you Santosh and Venkatesh. The sample time was 10 microseconds.
I was using time based generation of sine wave in the model and that was causing it to drift the amplitude of the sine. So with time, amplitude of sine was increasing to a point where it is always higher than the PWM reference, causing PWM to be always high. Once I change the sine wave generation to sample based, its working fine.
One interesting find is that, in the MATLAB block of sine, it mentions that samples per period=2*pi/(frequency*sample time). Although the code generated also does the 2*pi multiplication. So in the MATLAB sine wave block, the sample per period should be calculated as (1/(frequency*sample period)).
Thank you for your support.
Thanks,
Nakul