I'm looking for an IC that will give me a minimum of 6 independent PWM channels for motor control, preferably with an SPI interface but this isn't critical. My micro will be busy with floating point calculations etc so I don't want to risk tying it up. Any suggestions?
|
You already have this: There's no need to add another chip. As Olin and Steven stated, these hardware peripherals will probably use comparable CPU to an external peripheral. You do not risk typing your CPU up by employing hardware peripherals. More importantly, floating point on an AVR is your bottleneck, not the PWM. Consider choosing a microcontroller with floating point hardware, adding a coprocessor with floating point, changing to a processor which has floating point and 6 PWM channels (likely a DSP or ARM9 that will be much more complex and expensive than your Atmega88), or (preferrably) modifying your algorithms to be faster and use fixed point arithmetic. Speeding up the PWM from 0.2% to 0.1% (if using an external PWM IC is actually that helpful) won't help if your floating point algorithms are taking 200% of your CPU time. |
|||
|
|
I agree with Steven. There is no issue having the PWM produced by the same micro that is doing heavy computation because the PWM signals will be produced in hardware with no firmware intervention required except when you want to change the PWM properties. Integrated PWM modules is then a advantage because it will take less cycles to alter their configuration than it would to go over a SPI bus or something to communicate with a external PWM chip. All you need is a microcontroller with 6 or more hardware PWM channels. Take a look at the higher end dsPIC33Fs from Microchip. There should be a few with at least 6 PWM channels. 6 really isn't a enormous number for a high end controller nowadays. |
|||||||||
|
|
Hows about a second microcontroller? May be overkill, but you could easily configure one to be an SPI slave device to perform whatever functions you want it to - including PWM. |
|||
|
|
A separate microcontroller for your PWM, like Matt suggest, is a possibility, but maybe you don't even need that. You're not saying which micro you want to use, but the NXP LPC175x and LPC176x controllers have at least 6 PWM channels, which are controlled by timer hardware and don't require software once they're set, so you can spend more time on the calculations. Setting the timers shouldn't be more controller-intensive than maintaining a control line with an external controller. |
|||
|
|
Maybe LED drivers? RGB strips are usually controlled with PWM. There are some nice drivers out there that have a ton of channels, like 8 to 24 PWM outputs. Like the PCA9685. Unfortunately it's I2C and 16-channel (bit overhead) , but it's a dedicated PWM chip you can easily hook up some FET drivers for your motor. I think a much easier solution opposed to adding another microcontroller on your board. The PCA9685 can switch up to 1kHz, which seems fast enough to me for motors. |
|||||||||
|
|
(1) If an ATMega88 did the job before without using PWM, then using one as a slave would allow reuse of most software and hardware, at a cost about the same as a PCA9685. (2) The mentioned PCA9685 PWM driver is a very nice IC indeed. But if you wanted more flexibility and closer tailoring to your requirement, almost any modern fast cycle time processor would do the task with software PWM. If you wanted 256 steps (and you quite possibly don't for motor control) and a say 1000 Hz PWM frame rate (again rather faster than most motors would need) then two processor has to make decisions on 6 x PWM channels 256 x 1000 = 256000 times per second or once every microseconds. A processor running at 20 Mhz instruction rate (20 MHz clock with one instruction per cycle or whatever) has 80 instructions to handle this update, which is easily enough done using an ISR software timer based system. Chances are the requirement would be less demanding than above. A little faster could be handled with appropriate processor. A much faster implementation would "run out of wind" but chances are you don't need even this speed. |
|||
|
|
Use a PSoC3 ! You can have as many PWM channels as you want. I think up to 24. I am designing a board which has 5 x PWM, 5 x Quadrature decoders, and SPI, CRC generator and 5-channel ADC. This is for current control of 5 motors. It should be possible to have 6 of everything, instead of 5. They can also do centre-aligned PWM, which is critical for accurate current control measurement. |
|||
|
|
