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.

28335 sine_table PWM question



I have been looking around on the forum and have found bits and pieces of what I need but I am still unsure of a few things and was wondering if anyone can provide some feedback.

Basically I am just trying to free spin my dc motor (3phase) for the moment as a starting point. I believe I have the pwm module setup the way I need to and I am getting the interrupt when I need to which is 30khz. As a side note, the interrupt seems to jump around a lot. Instead of always being at about 66 or so microseconds (i am using a 32MHz crystal and pll settings for 144MHz) it jumps from 66 to 69, to 65 etc. The only other interrupt that I'm using is an SCI (pie group 9 so it has lower priority anyway) so I don't think it's anything I am doing. Is the BIOS holding me up in some cases potentially? Is there something I can do do make that a rock solid 30khz interrupt?

Anyway, back to the PWM. I can get the motor to lock up if I give each phase a static value so their fighting each other and the shaft can't spin, but now I want to free spin it. I believe, from posts on the forums and examples here and there that I can use the sine_table in the IQMathTables to help generate sine waves for the PWM compare values. What I am confused about is that the examples/posts talk about putting that code to update the compare values in the PWM interrupt, which is fine, but how do you determine what the frequency will be for the signals?

For example, in my PWM interrupt (which again is 30khz) I do something like

EPwm1Regs.CMPA.half.CMPA = EPwm1Regs.TBPRD - _IQsat(_IQ30mpy((sine_table[index]+_IQ30(0.9999))/2,EPwm1Regs.TBPRD),EPwm1Regs.TBPRD,0);

index++;
if (index >511) index = 0;

What will the modulation frequency on the PWM line be? Will it be the same 30khz?

Thanks for your help