ePWM setting for C2000 DSP, output not the right frequency

조회 수: 19 (최근 30일)
Mike Buba
Mike Buba 2018년 7월 12일
답변: Venkatesh Chilapur 2018년 7월 16일
Hi All,
I am trying to generate PWM pulses for a three-phase inverter using C28335 DSP and Matlab Simulink. My switching frequency is set to 6 kHz and DPS is 150 Mhz (Timer period TBPRD = 12500). I am sending a 50 Hz sinusoidal reference, but my measured AC voltage output is 12,5 Hz! Why is this happening? Is there a setting I missed in ePMW block.
Also, if I look at ePWMA and ePWMB panes setting, is there a mistake for ePWMB output pane -- should CMPA on up-count (CAU) be set to Do nothing instead of Set? I don't know where this four times lower frequency comes from. I assume even the phases are not 120° deg shift.
Interestingly enough, when I connect with External mode and record data, the output voltage is 50 Hz. But on an oscilloscope with a differential probe is 12,5 Hz!

채택된 답변

Venkatesh Chilapur
Venkatesh Chilapur 2018년 7월 16일
Hi Mike,
Regarding your point of 'Also, if I look at ePWMA and ePWMB panes setting, is there a mistake for ePWMB output pane -- should CMPA on up-count (CAU) be set to Do nothing instead of Set?' the configuration for CAU field for ePWMB is independent of CAU field for ePWMA. So this configuration on one output will not impact output.
And going by your model it is very likely that since you have used Simulink 'Sine wave' blocks, it will generate code that is not optimized for embedded applications. This can result in overrun scenario as you clearly identified. We encourage you to use TI Math Library to generate the Sine values.
The following link provides some insight in to the same.
https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/40262?Sine-function-on-F28335
To interface to external C/C++ code from Simulink, like in this case you will need to call the Sin() function from Math library, please following the link:
https://in.mathworks.com/matlabcentral/answers/51908-how-can-i-implement-coder-ceval-in-simulink
You can also quickly do the real time execution profiling of the generated code by following link:
https://in.mathworks.com/help/supportpkg/texasinstrumentsc2000/examples/real-time-code-execution-profiling.html
HTH,

추가 답변 (1개)

Venkatesh Chilapur
Venkatesh Chilapur 2018년 7월 13일
Please share your model and provide MATLAB version details, and Hardware version details for further investigation.
  댓글 수: 1
Mike Buba
Mike Buba 2018년 7월 13일
편집: Mike Buba 2018년 7월 14일
Hi Venkatesh,
please find simple model in the attachment. It contains voltage reference that is multiplied by sine waveform and this is input to PWM. Switching frequency is 4 kHz and DPS base frequency is 150 MhZ which gives Timer period TBPRD = 18750. I am using sinusoidal modulation for three-phase inverter.
PWM block is from the C2000 DSP library for C28335 processor (you need this to look into block). I am running all this on TMS320F28335 Experimenter Kit. Matlab is R2015a and Code Composer Studio is 5.5.
Kind regards
.
Update:
If I set samples per period two times higher (Tcontrol*2) I can get closer to 50 Hz but still not exactly. My reference is 100 Hz as recorded by Simulink, but output voltage frequency is ~ 45 Hz
.
ePWM settigns:
.
Update II:
When I run only open loop three-phase inverter (simplified code, only reference and PWM as in the attachment) I can get frequency around 40 Hz (with initial settings for Tcontrol = 5e-5 sec).
As if this task is not executing at Tcontrol but with some other sample time?! The 'smaller' the code the closer I am getting to 50 Hz output frequency! All inputs to PWM block are with sample time Tcontrol. This might explain why my software recoding is always 50 Hz, but output changes its frequency as the size of the code changes.
Can I somehow see if I have overflow or check that the code is completely executed in sample time?
I cannot explain why my reference is 50 Hz and output changes its frequency as the size of the code changes. PWM switching frequency is always 4 kHz (measured by oscilloscope), only reference changes its frequency. Can You please provide any explanation and advice on how to solve this problem.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 C2000 Microcontroller Blockset에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by