Re: Is a CPLD appropriate for this triple PWM application?



(my response is all the way @ the bottom)
On 16 Sep 2005 09:42:25 +0200, David Brown
<david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>Jim Granville wrote:
>> they call me frenchy wrote:
>>
>>> On 15 Sep 2005 10:35:32 +0200, David Brown
>>> <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>
>>>> Unless you have complex timing requirements, a small micro would be
>>>> the best for making 3 PWMs. Get a small msp430 processor - they are
>>>> cheap, easy to work with, and have good free tools (the gcc port is
>>>> excellent, and there are free versions of ImageCraft and IAR tools
>>>> for limited program sizes).
>>>
>>>
>>>
>>>
>>> David,
>>> Thank you very much for your response. I am new to programmable logic
>>> and I really appreciate the suggestion. Just to make sure that I
>>> paint the entire picture, here are my full requirements...
>>>
>>> 1) 3independent PWM generators running at the same frequency. I am
>>> starting with 8-bit, but I could justify going down to 7bit and
>>> maaaaaaybe 6 or even 5 bit if it will save me much grief.
>>>
>>> 2) The FSM will probably have 8 states (cylcled through with a simple
>>> pushbutton, no reset). State 1 will tell PWM1 to run at 90% and PWM2
>>> and 3 to be off. The rest of the states will turn the PWMs off and on
>>> in a variety of ways. The most complex of the states will tell all 3
>>> PWMs to cylce from 10% to 90% out of phase from each other at about
>>> 0.5Hz. I do not have complex timing requirements.
>>>
>>> 3) I would like to detect the battery voltage and when it is running
>>> semi low, I would like to scale down the values of ALL PWM signals to
>>> extend battery life. For example, full battery = all PWMs @ 100%,
>>> battery 1/2 dead = all PWMs @ 50%, battery pretty much dead = sleep
>>> mode until the batteries start to receive a recharge, which could be
>>> several hours away.
>>>
>>> I got a Coolrunner II development kit just to get going with a
>>> 256macrocell chip onboard. I will plan on testing my functionality on
>>> that even if I fill the whole damn thing and then perhaps migrate to
>>> your recommended MSP430 after some research to prove why that would
>>> indeed be better than a CPLD.
>>>
>>> My application is geared towards a very high quantity consumer part,
>>> so I would like to see the chip cost under US$1 at quantity. I know
>>> that I have an uphill climb in front of me and my boots are on.
>>
>>
>> This does not sound like a CPLD problem. A fundamental determinant in
>> cost is pin count, and there are no 8 or 14 pin CPLDs.
>> CPLDs also have narrow Vcc tolerance, and in some cases, need Two supplies.
>> You will also find the 10-20uA the CPLD vendors boast of, is MUCH higher
>> than the Static Icc of Microcontrollers. There are no CPLDs with low
>> power on-chip oscillators...
>>
>> You have not mentioned the PWM frequency, but the usage and action
>> sounds like a lighting effects one, so you do not need the 300Mhz clock
>> rates of a CPLD.
>>
>> Do a pin-count budget, and then choose a 8 pin or 14 pin
>> Microcontroller. [I'd start with 14, and then see if it will fit in 8,
>> when you are all done]
>>
>> For 8 & 14 pin Microcontrollers, look at
>> Atmel, Freescale, Microchip, Philips, ST, TI, Zilog (etc)
>>
>> This application will move across uC quite easily, so choose the
>> one that looks easiest for you to learn, and get it working on that,
>> then start the bidding process, when it hits real volume :)
>>
>>
>>> If I indeed switch over to a MSP430, will my VHDL code that I am
>>> writing now be able to come with me?
>>
>>
>> NO, but the ideas will.
>>
>
>Additionally, if you want to measure battery voltage, you'll need some
>sort of ADC. There are lots of small micros with an ADC, whereas with a
>CPLD you'd need an external ADC.
>
>I think Atmel have some new AVR chips aimed specifically at lighting
>applications, with very flexible PWM outputs. I don't know the details,
>but they'd be worth a look.
>
>Your software is going to be vastly easier to write and test in C on a
>microcontroller, rather than VHDL on a CPLD.


The responses from both David Brown and Jim Granville have been
infinitely helpful. What an idiot I am. You both hit the nail on the
head...the application is indeed a lighting effects one.
Independently controlling 3 LxExDs (or6)(or9)(or12)(or15) only
requires a PWM frequency of 100Hz to a couple kHz. I suppose that it
is just stupid to be looking @ a CPLD, especially when power
consumption and price are very important driving factors. I guess in
my mind I knew that the PWM frequency could be low, but that all of
the logic required was complex and needed a much faster clock.

As I mentioned previously, I am just getting back into electronic
design for the 1st time pretty much since college. I have never used
a uC before and I gravitated to Xilinx because I took a introductory
FPGA course in college and I knew that it would functionally
accomplish most of my requirements (I used one to simulate the insides
of a pop machine). The fact that I have never used a uC before really
bit me in the a$$. Thank you for your patience!

I am about done with my 1st run of VHDL code and about ready to
program my CoolRunnerII 256 for the 1st time (everything is simulating
great). I will finish that in order to test my optics & LxExD driving
circuits and meanwhile I will indeed look into the uC solutions that
both of you presented above.

I appreciate your input. You will probably hear from me again in the
coming weeks. BTW, what is the most appropriate newsgroup for my new
uC path?

infinite gratitude,
frenchy
.