Reply by Jim Granville September 19, 20052005-09-19
they call me frenchy wrote:
> On Fri, 16 Sep 2005 23:06:05 +0200, "Falk Brunner" > <Falk.Brunner@gmx.de> wrote: > > >>For LEDs, PWM is just as good as PDM. PDM has the advantage that you can use >>lower clock frequencies, but this is not a real advantage. >> >>Regards >>Falk >> > In battery powered applications I was under the impression that > lowering the clock frequency was one of the main keys to saving > precious power. Also, the fact that PDM uses less logic resources > than does PWM further tells me that PDM has an edge over PWM for > L..E..D applications.... but I see that most driver ICs for this this > application use PWM pretty much exclusively, hmmmm.
A minus of PDM, is there are more edges, and thus more EMC issues.... Because Microcontrollers target wider markets, and have timers with capture/compare from way back, they almost all use PWM. In terms of uC die area, the difference is not significant. However, (just to keep you on your toes), a few use a mix of PWM and PDM, and we have done a design that used a UART to generate PWM+PDM DAC output. -jg
Reply by they call me frenchy September 19, 20052005-09-19
On Fri, 16 Sep 2005 23:06:05 +0200, "Falk Brunner"
<Falk.Brunner@gmx.de> wrote:

>For LEDs, PWM is just as good as PDM. PDM has the advantage that you can use >lower clock frequencies, but this is not a real advantage. > >Regards >Falk > >
In battery powered applications I was under the impression that lowering the clock frequency was one of the main keys to saving precious power. Also, the fact that PDM uses less logic resources than does PWM further tells me that PDM has an edge over PWM for L..E..D applications.... but I see that most driver ICs for this this application use PWM pretty much exclusively, hmmmm. thx, frenchy
Reply by David Brown September 19, 20052005-09-19
they call me frenchy wrote:
<snip>

> 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
That would be comp.arch.embedded. If you go for the AVR, you'll also find www.avrfreaks.net to be very helpful. mvh., David
Reply by Falk Brunner September 16, 20052005-09-16
"they call me frenchy" <solarfrenchyNO@SPAMhouseofharmonystudios.com>
schrieb im Newsbeitrag

> Right, but my question (as elementary as it may be) was whether PDM > would work for such an application or whether PWM is preferred for any > particular reason. Both of them seem to acheive the same thing in > different ways assuming the frequency is adequately high.
For LEDs, PWM is just as good as PDM. PDM has the advantage that you can use lower clock frequencies, but this is not a real advantage. Regards Falk
Reply by they call me frenchy September 16, 20052005-09-16
On Fri, 16 Sep 2005 18:39:59 +0200, "Falk Brunner"
<Falk.Brunner@gmx.de> wrote:

> >"they call me frenchy" <solarfrenchyNO@SPAMhouseofharmonystudios.com> >schrieb im Newsbeitrag > >> Aha, I see. I will be driving normal L..E..D..s and now that I >> understand the difference between PWM and PDM, I ask the following >> question... >> >> Since I want to keep system cost to a minimum, I should avoid adding >> an extra LPF....will PDM work, or should I just stay with PWM? I will >> research this tomorrow, but feel free to comment if you like. > >For driving LEDs you dont need (and dont should use!) a LPF (low pass >filter). The filtering is done by the eyes/brain ot the observer. Just keep >the PWM frequency high enough to avoid flickering (100 Hz ++). The only >thing you need is the current limiting resistor. > >Regards >Falk > >
Right, but my question (as elementary as it may be) was whether PDM would work for such an application or whether PWM is preferred for any particular reason. Both of them seem to acheive the same thing in different ways assuming the frequency is adequately high. grusse, frenchy
Reply by Falk Brunner September 16, 20052005-09-16
"they call me frenchy" <solarfrenchyNO@SPAMhouseofharmonystudios.com>
schrieb im Newsbeitrag

> Aha, I see. I will be driving normal L..E..D..s and now that I > understand the difference between PWM and PDM, I ask the following > question... > > Since I want to keep system cost to a minimum, I should avoid adding > an extra LPF....will PDM work, or should I just stay with PWM? I will > research this tomorrow, but feel free to comment if you like.
For driving LEDs you dont need (and dont should use!) a LPF (low pass filter). The filtering is done by the eyes/brain ot the observer. Just keep the PWM frequency high enough to avoid flickering (100 Hz ++). The only thing you need is the current limiting resistor. Regards Falk
Reply by they call me frenchy September 16, 20052005-09-16
On Thu, 15 Sep 2005 21:51:19 +0100, "Luis Cupido"
<cupidoREMOVE@REMOVEua.pt> wrote:

>Hi, > >Ha!!! What they do is PDM pulse density modulation not PWM, >may work the same for you... don't know, depends on how you use it. >The PWM-pulse width modulation with a constant single >output frequency with variable duty cycle, must be with a count and compare >;) > >> Although I will not be using a LPF >> in my application, I remember his statement about logic. > >So, that is the problem... after a low pass filter both are equal, and PDM >is more >tolerant on filtering, but for direct use they are different ! >think well if PDM does the same for you or not :) > >...me, controlling step motors didn't had much luck with it ;) > >lc. >
Aha, I see. I will be driving normal L..E..D..s and now that I understand the difference between PWM and PDM, I ask the following question... Since I want to keep system cost to a minimum, I should avoid adding an extra LPF....will PDM work, or should I just stay with PWM? I will research this tomorrow, but feel free to comment if you like. thanks for your input, Luis! frenchy
Reply by they call me frenchy September 16, 20052005-09-16
(my response is all the way @ the bottom)
On 16 Sep 2005 09:42:25 +0200, David Brown
<david@westcontrol.removethisbit.com> wrote:

>Jim Granville wrote: >> they call me frenchy wrote: >> >>> On 15 Sep 2005 10:35:32 +0200, David Brown >>> <david@westcontrol.removethisbit.com> 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
Reply by David Brown September 16, 20052005-09-16
Jim Granville wrote:
> they call me frenchy wrote: > >> On 15 Sep 2005 10:35:32 +0200, David Brown >> <david@westcontrol.removethisbit.com> 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.
Reply by September 15, 20052005-09-15
Atmel has an example that fits 4 8-bit PWM controllers in a 32
macrocell CPLD.  It is written in CUPL.

You need to download their tools at:

http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2759

The file is PWM8X4.PLD

kevin