Request for Insight: 3 phase motor controller with KE02Z

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Request for Insight: 3 phase motor controller with KE02Z

959 Views
daveboyle
Contributor III

Hi. I’m a kinetis newbie. I bought a Frdm-K02z for $13.50 to smarten up a big tesla coil I’m building. I thought it would be easy to set up and program an mcu since all the kids these days are doing it. But after dozens of hours of reading, learning and cramming, frustrating failure and so few golden breakthroughs, I’m finally able to do things with KDS 2.0.0 and PE on Ubuntu 14.04. But only some things.

I have to run kds as root out of a terminal, which is good because I can see what it’s up to. The PEmicro dubug link worked right away but was very slow, Segger J-link only worked the second time I installed it, and OpenSDA has never worked for me. Printf eluded me for a long time but I finally got it working through segger. I can only dim 2 led colors with pwm at once and I never got the TSS Library to work. Ksdk doesn’t work. I never got any examples to work and most tutorials I followed led nowhere. The only stuff I have made work is what I write from scratch. Now I can add and configure components, jump to methods, spell the property names correctly and things are happening. I really like PE and all that it does for me, and Eclipse (never used it before) always shows me where the warnings and errors are so I don’t have to track them down. Very slick.

Now I can start to develop my project which is a basic single phase 120vac to 3 phase 230vac inverter to drive a synchronous acim motor. I already have a 3-phase driver board that’s good for 1000 watts even though I only need 200. It provides the voltage and big igbt switches. It just needs 3 pwm signals that correspond to sine waves each 120 degrees apart from each other. With up and down signals for each wave that makes 6 wires total. So I want to set up a 6 channel timer in complementary mode with dead time insertion to feed the driver board.

The source of my sine waves is novel: I will transform the ac line down to 1 or 2 volts, add a dc bias to put it up above ground and then sample it with an A/D converter. Fill one or 2k of ram with the data, then read it out from 3 different places while continuing to sample and record, overwriting the old data with the new. Sounds like I’ll need some multi-threaded code there. I need to do this because my motor spins a disk studded with electrodes and the rotation must be synchronized with the ac line. So when the ac line voltage peaks the electrodes are in the firing position. That’s why an ordinary vfd won’t do, they rectify the line and all the phase information is gone. See my pictures at teslafirma.shutterfly.com. Commercial vfd’s often output pwm signals in the 12 to 16 khz range which is several times faster than I will be sampling. I suspect that I will use an interrupt to sync the input samples with the output pulses but I’m not there yet.

What I’m hoping to get from the Kinetis community is any ideas, tips, gotchas and flashes of inspiration that immediately spring to mind. I don’t need my app to be written for me, just any advice experts can throw me to help make this easier. I can assemble the final project myself. So if any part of this project no matter how small jumps to mind then please let me know. Thanks for your time and have a great day!

4 Replies

759 Views
mjbcswitzerland
Specialist V

Hi Dave

I wish you success with your work.

The only thing that would worry me is the fact that the KE02 has only a small RAM footprint (4k), whereby you plan to possibly use half of it already for sampling a phase to.

Personally I would have chosen something like the K64F board since it has 256k RAM and so give lots of head-room - since its Freedom board only costs about $28 for a one-off like yours it would potentially save you lots of development time and then allow for many features to be added that the KE02 may well make impossible.

The K64 is about 3x faster and also has an FPU in case your wanted to do DSP type calculations.

If you later want to control it remotely via Ethernet or locally via USB, or log its behavior to an SD card over long period so time the FRDM-K64F would have everything already built in (even if not used on day 1).

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support / µTasker FRDM-KE02Z40M support / µTasker FRDM-KE06Z support

K64: µTasker Kinetis FRDM-K64F support / µTasker Kinetis TWR-K64F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

759 Views
daveboyle
Contributor III

That sounds fine to me. I actually bought the KE02Z for a different project using the IR functions. It was a happy coincidence that it happened to have PWM timers. I'm not stuck to it and the K64F does look like a powerhouse. I notice that KDS 2.0 supports not just the cpu but the board as well. Looks like Freescale is going to get some more of my money. I hope they spend it wisely!

0 Kudos

759 Views
adriancano
NXP Employee
NXP Employee

Hi,

The KEx devices are also a good option, but as Mark said, using a K6x device is also a good option for the enhanced characteristics. You can have a look at this reference design that is for a KEA device, it is just for your reference: 3 phase BLDC with KEA it is not the same application you are trying to set but it will give you some ideas.

Also you can find relevant information typing: 3 phase motor in the Freescale Search.


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

759 Views
daveboyle
Contributor III

Thank you for those excellent tips. I bought a K64F and I can look at the pwm outputs on my oscilloscope. So far I have 2 combined complementary channels with inversion and deadtime insertion. I use the init_ftm component to do all that. I found the macros that control the timer, and the write up of the invctrl register on page 999 or the 1800 page cpu manual. But I'm having trouble finding a software switch that will turn off channel one and after a deadtime turn on channel 2. I found an audio delay example that samples with the adc, reads it into ram using dma and then reads it out the dac to form an audio delay line. My project is quite similar to that except I'm sampling the ac line and writing it out in 3 phases of pwm. I like the idea of setting up the peripherals so they will keep on working even if the core is paused in a debug session. So my present problem is finding a way to switch from channel n to channel n+1 and back again. Thanks again for the great support!