PWM control of 3-phase acim motor gone wrong

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PWM control of 3-phase acim motor gone wrong

1,102件の閲覧回数
daveboyle
Contributor III

Hello, I'm using a FRDM-K64F and some custom hardware to spin a 3-phase synchronous ac motor. The motor will spin at it's native speed, 1200rpm, but it has to remain phase locked to the zero crossings of the ac line. The motor is a rotating spark gap for a tesla coil and the 6 firing electrodes must be in the same place on the ac cycle every time.

 

As you can see from the enclosed KDS 3.0 and PeX project I have used 6 pwm components and a ppg. I use the ppg to make the fine frequency adjustments that are needed to sync the pwm outputs to the zero crossing pulses from an external op amp circuit. That works great. Pairing of the 6 pwm outputs and dead time insertion is all done in my C code but there's a problem. When I disable one pwm output in a pair it doesn't go off. That is essential to avoid putting the igbt's on my power inverter board into a dead short. It's hard to see these signals accurately even though I have a good scope so I added a little test in my code. It puts out 4 fixed width pulses on one pwm output, then disables it and sets it high, then puts out 4 pulses on another. I should see the exclusive swapping of channels on my scope but I don't. I see them both at the same time with lots of overlap.

 

So what am I doing wrong? Should I use the pwm interrupts instead of the ppg? So far I need the ppg to make the fine frequency adjustments I need for syncing. Is there some other low level method of disabling a pwm channel? Any help will be greatly appreciated!

Original Attachment has been moved to: k64First.zip

0 件の賞賛
5 返答(返信)

731件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Dave,

As I said that the PWM1_Disable(); function clears the the CLKS bits in FTM_SC register, which leads to  stop of the FTM, so all PWM channels will be disabled after you call the PWMx_Disable().

If you just want to disable some PWM channels, while keep the other PWM channels running, I suggest you use mask function. Setting the CHxOM in FTM_OUTMASK register makes the FTM_CHx channels masked, in other words, the FTM_CHx pin becomes low or High which is specified in FTM_POL register.

If you want to mask the PWM channels, pls refer to the section 40.4.11.7 OUTMASK register synchronization. Clearing the SYSCHOM bit, after you write the FTM_OUTMASK register, the corresponding FTM channels with CHxOM set bit will be come high or low, the corresponding channels with CHxOm bit cleared will run normally.

BR

XiangJun Rong

0 件の賞賛

731件の閲覧回数
daveboyle
Contributor III

You got it XiangJun, that is excellent customer support. I'll try and puzzle out the bare metal manipulation of registers, up to now I've been spoon fed the easy way. Hopefully the register and bit names in the manual are already defined somewhere. In the meantime, please suggest to the PeX team that they add additional methods to the PWM component that will Mask and Unmask individual channels without taking down the whole timer at once. I'm not an engineer so I don't understand why the existing Enable and Disable methods are so un-intuitive, lame and useless. Thanks again for your help!

0 件の賞賛

731件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Dave,

Firstly, I have downloaded your project, but I can not load it into KDS tools, because your original project does not include the .project file. I do not know how you synchronize the phase locked to the zero crossings of the ac line, which signal is synchronized with zero-crossing signal of AC line? do you use the motor as a generator?

Anyway, if you call the  PWM1_Disable(void) to disable the PWM signals of FTM, you clear the CLKS bits in FTM_SC register, which will make the FTM_CHx signal in high-impedance states, so you have to connect a 5K~10K ohm pull-down resistor for each PWM pins so that the PWM pins are all in low state.

Pls connect a pull-down resistor for each PWM pins.

Hope it can help you.

BR

XiangJun Rong

0 件の賞賛

731件の閲覧回数
daveboyle
Contributor III

Okay so I figured it out. I made a simple test project in KDS 3.0 using PeX. It has 3 PWM components all running off Timer3 on channels 0, 1 and 2. There is also an Init_PIT component that generates an interrupt. On opposite cycles (determined by a boolean) of the interrupt, I enable and disable only ONE of the 3 PWM outputs. Like this:

void onek (void) {

  PIT_PDD_ClearInterruptFlag(PIT_DEVICE, 0);

    swap = !swap;

    if (swap) { PWM1_Enable(); }

    else { PWM1_Disable(); PWM1_ClrValue(); }

}

When I look at the output of the 3 PWM's on my 3-trace oscilloscope, I see that ALL 3 of the outputs are enabled and disabled. Even though I only wrote commands for one channel. I can choose any channel to modulate in this way and the other 2 will do the same thing. So the PWM(n)_Disable statement is disabling all PWM outputs that come from the same timer.

This can't possibly be expected behavior.

Please let me know how I can switch off only one channel at a time.

pwmout.jpg

0 件の賞賛

731件の閲覧回数
daveboyle
Contributor III

Hello Xiang, thank you for your reply. I just zipped up the files in my project directory but it missed the hidden files so I have included the .project file.

The high-z state is what I want since that will turn off the optocoupler. But perhaps what I am seeing on my scope is an artifact. I will add pull down resistors and see how that looks.

My code works by creating an array called "hold" in the main loop and filling it with 2 positive cycles of a sine wave. It looks like a full wave rectified sine wave. The array is read out to the pwm's at a frequency controlled by a ppg, around 21khz. There is the base array index counter called angle, and 3 others called angle1, angle2, and angle3. In events.c, a zero crossing pulse from custom op-amp hardware fires an interrupt. Two cycles after that interrupt the base array index counter should be 0 or 180. If it is then all is fine and it is in sync. If it is too soon or too late then an adjustment is made to the ppg frequency so that the next time it will be in sync. This part of the code works very well and I can see on my scope that the array is read out with excellent accuracy. The 3 other angle(n) variables read out the array at offset values of 120 and 240 degrees to get the 3 phases. As well a small correction called "shift" is added in that gets it's input from a switch I have connected as a pair of bitIO's. The phase shift lets me make fine adjustments in the spinning of the disk.

There is also an output that fires some bright led's at 360 per second to make a strobe light that will freeze the spinning disk visually to give feedback to the operator. There is no current sensing feedback from the motor which would be yin, my code is all yang. I hope all of this makes sense. Thank you for your help!

0 件の賞賛