EmbeddedRelated.com
Forums

PWM on LPC936

Started by slavkok July 8, 2010
Hello..

I Try to setup CCU PWM unit in LPC936 but cant get it working.
Timer 0/1 as pwm works great but I need more PWM's

The unit is clocked with 18MHz external crystal.

So I intend to use CCLK (18MHz) as CCU clk as PLL can't be set correctly with crystal over 16MHz. Or I'm wrong?

Pin P2.1 is set as Pushpol output and folowed code should 50%/50% cycle but it's on LOW all the time

mov .TCR20,#$06 ;asimetric PWM/DOWNCOUNT
mov .CCCRD,#$01

mov .TOR2H,#$01
mov .TOR2L,#$00
mov .OCRDH,#$00
mov .OCRDL,#$80
mov .TCR21,#$80
;
Someone know solution?!?

slavkok pravi:
> Hello..
>
> I Try to setup CCU PWM unit in LPC936 but cant get it working.
> Timer 0/1 as pwm works great but I need more PWM's
>
> The unit is clocked with 18MHz external crystal.
>
> So I intend to use CCLK (18MHz) as CCU clk as PLL can't be set correctly with crystal over 16MHz. Or I'm wrong?
>
> Pin P2.1 is set as Pushpol output and folowed code should 50%/50% cycle but it's on LOW all the time
>
> mov .TCR20,#$06 ;asimetric PWM/DOWNCOUNT
> mov .CCCRD,#$01
>
> mov .TOR2H,#$01
> mov .TOR2L,#$00
> mov .OCRDH,#$00
> mov .OCRDL,#$80
> mov .TCR21,#$80
> ;
> Someone know solution?!?
>
>
I'm wrong..

PLL use PCLK and this is CCLK/2.
Seems that CCU as PWM must use PLL as now with PLL works.

Yes, make sure you have a pull up resistor on the PWM pin to VCC of the chip or it will not start PWM.

Found this out the hard way. Typical value of 2.2K will work fine.

--- In l..., Slavko Kocjancic wrote:
>
> slavkok pravi:
> > Hello..
> >
> > I Try to setup CCU PWM unit in LPC936 but cant get it working.
> > Timer 0/1 as pwm works great but I need more PWM's
> >
> > The unit is clocked with 18MHz external crystal.
> >
> > So I intend to use CCLK (18MHz) as CCU clk as PLL can't be set correctly with crystal over 16MHz. Or I'm wrong?
> >
> > Pin P2.1 is set as Pushpol output and folowed code should 50%/50% cycle but it's on LOW all the time
> >
> > mov .TCR20,#$06 ;asimetric PWM/DOWNCOUNT
> > mov .CCCRD,#$01
> >
> > mov .TOR2H,#$01
> > mov .TOR2L,#$00
> > mov .OCRDH,#$00
> > mov .OCRDL,#$80
> > mov .TCR21,#$80
> > ;
> > Someone know solution?!?
> >
> >
> >
> >
> I'm wrong..
>
> PLL use PCLK and this is CCLK/2.
> Seems that CCU as PWM must use PLL as now with PLL works.
>

kittmaster pravi:
> Yes, make sure you have a pull up resistor on the PWM pin to VCC of the chip or it will not start PWM.
>
> Found this out the hard way. Typical value of 2.2K will work fine.
>
>
??? Not needed!!
Just configure pin as push pull output! It's works.
Wrong, the push pull design is disabled in code to open drain. Check your code, don't believe that, use code architect to validate the result of the GPIO setup configs.

It cost a full PCB respin after problem was found and tact soldered a resistor in place to get PWM drive to work correctly.

Since your having the problem, and I've done it first hand, what is there to argue about?

Either way, good luck.

--- In l..., Slavko Kocjancic wrote:
>
> kittmaster pravi:
> > Yes, make sure you have a pull up resistor on the PWM pin to VCC of the chip or it will not start PWM.
> >
> > Found this out the hard way. Typical value of 2.2K will work fine.
> >
> >
> ??? Not needed!!
> Just configure pin as push pull output! It's works.
>

kittmaster pravi:
> Wrong, the push pull design is disabled in code to open drain. Check your code, don't believe that, use code architect to validate the result of the GPIO setup configs.
>
> It cost a full PCB respin after problem was found and tact soldered a resistor in place to get PWM drive to work correctly.
>
> Since your having the problem, and I've done it first hand, what is there to argue about?
>
> Either way, good luck.
>
>
That's odd.
I have working board without pullup's and I clearly see difference if
change port from quasibidir to pushpull on scope.