Looking at the code ( I don't have an LPC2xxx to test ), it seems that
you
put the timer into PWM mode before setting up PWMMR0 which is used to reset
the timer.
According to the user manual if the timer is in PWM mode you need to set the
bits in PWMLER to transfer values to the PWMMR registers, but when you write
to PWMLER you only write 0x24.
This implies that PWMMR0 would not get updated so the counter may simply be
stuck at zero.
Surely the value written to PWMLER should be 0x25.
Regards
Phil.
From: l... [mailto:l...] On Behalf Of
madbaxyh
Sent: 24 April 2012 22:40
To: l...
Subject: [lpc2000] Re: Help on PWM basic code
I tryed compiling without Startup.s file... uVision didn't show any
error
but pwm doesn't work yet.
after that, I used startup.s from another functional project that uses UART,
but pwm doesn't work...
it seems to be DOWN all the time (the voltage is very low)
PS: Sorry about the PWMLER, i didn't know that detail.
--- In l..., "Alexan_e" wrote: >
> It should work fine , so what is the level you see at the PWM pins?
> Is it constant high or low?
> The pins are not connected to anything and you just connect the
osciloscope?
>
Reply by Alexan_e●April 19, 20122012-04-19
It should work fine , so what is the level you see at the PWM pins?
Is it constant high or low?
The pins are not connected to anything and you just connect the osciloscope?
----- Original Message -----
From: madbaxyh
To: l...
Sent: Friday, April 20, 2012 2:32 AM
Subject: [lpc2000] Re: Help on PWM basic code
I've made blink and UART tests to the mcu and it worked fine.
I'm trying in two different circuits with the same mcu (LPC2148), both
runs the blink and UART codes correctly. also, i do have an oscilloscope for
watching the PWM output.
PWM doesn not need special hardware or inputs, does it?
--- In l..., "Alexan_e" wrote:
>
> Apart from the wrong setting for the PWM5 pin everything was already
correct.
> Your code works fine in KEIL simulation so there is something wrong with the
hardware.
>
> Are you sure that the mcu is programmed properly?
> Have you tried a simple blinky application to see if you can upload and
execute some code?
> How fo you check the PWM output , do you have something connected to the
pins?
>
> Alex
>
Reply by madbaxyh●April 19, 20122012-04-19
I've made blink and UART tests to the mcu and it worked fine.
I'm trying in two different circuits with the same mcu (LPC2148), both runs
the blink and UART codes correctly. also, i do have an oscilloscope for
watching the PWM output.
PWM doesn not need special hardware or inputs, does it?
--- In l..., "Alexan_e" wrote: >
> Apart from the wrong setting for the PWM5 pin everything was already
correct.
> Your code works fine in KEIL simulation so there is something wrong with the
hardware.
>
> Are you sure that the mcu is programmed properly?
> Have you tried a simple blinky application to see if you can upload and
execute some code?
> How fo you check the PWM output , do you have something connected to the
pins?
>
> Alex
>
Reply by Alexan_e●April 19, 20122012-04-19
The PWMLER register is not used in my code because I set all the values of the
match registers and then I enable the PWM.
The PWMLER is only needed when the PWM is running and you want to set a new
value when a match occur.
Alex
----- Original Message -----
From: madbaxyh
To: l...
Sent: Friday, April 20, 2012 2:18 AM
Subject: [lpc2000] Re: Help on PWM basic code
I gave a try to ARMwizard and it looks so useful but although I
configured PWM module it doesn't work yet.
here is the code generated + PWMLER that didn't apare.
Reply by Alexan_e●April 19, 20122012-04-19
Apart from the wrong setting for the PWM5 pin everything was already correct.
Your code works fine in KEIL simulation so there is something wrong with the
hardware.
Are you sure that the mcu is programmed properly?
Have you tried a simple blinky application to see if you can upload and execute
some code?
How fo you check the PWM output , do you have something connected to the
pins?
Alex
----- Original Message -----
From: madbaxyh
To: l...
Sent: Friday, April 20, 2012 2:12 AM
Subject: [lpc2000] Re: Help on PWM basic code
I gave a try to ARMwizard and it looks so useful but although I
configured PWM module it doesn't work yet.
here is the code generated + PWMLER that didn't apare.
/***********************************************************************\
************* Code created using the ARMwizard, visit http://alexan.edaboard.eu
************************************************************************\
************/
#include
I gave a try to ARMwizard and it looks so useful but although I
configured PWM module it doesn't work yet.
here is the code generated + PWMLER that didn't apare.
/*********************************************************
Code created using the ARMwizard, visit http://alexan.edaboard.eu
***********************************************************/
}
--- In l..., "Kevin" wrote: >
> Be careful with using PINSEL1=0x00000400;
> you might accidentally set or reset the functions on other pins as well.
>
> --- In l..., Alexan_e wrote:
> >
> > PINSEL1 = 0x300;// Enable PWM5
> >
> > The above is not correct , the value 0x300 sets P0.20 to EINT3.
> > For P0.21 set to PWM5 use PINSEL1=0x00000400;
> >
> > I would suggest you download ARMwizard to avoid such mistakes
> > http://alexan.edaboard.eu/
> >
> > The power control for PWM can be enabled using:
> > PCONP = (PCONP & 0x801817BE) | (1UL<<5); /* Enable peripheral clock for
> > PWM0 (default is enabled) */
> >
> > Alex
> >
> >
>
Reply by madbaxyh●April 19, 20122012-04-19
I gave a try to ARMwizard and it looks so useful but although I
configured PWM module it doesn't work yet.
here is the code generated + PWMLER that didn't apare.
/***********************************************************************\
************* Code created using the ARMwizard, visit http://alexan.edaboard.eu
************************************************************************\
************/
#include
--- In l..., "Kevin" wrote: >
> Be careful with using PINSEL1=0x00000400;
> you might accidentally set or reset the functions on other pins as well. In other words, always use something like:
PINSEL1 |= 0x00000400;
Check out the demo code at www.jcwren.com/arm Everything you could possibly
want to know about the LPC2148 is contained in that demo code.
There is a simple example of PWM on the PWM5 output.
I didn't look at the startup code but it will very likely set the
peripheral clock. This clock will be the source for the PWM module so
understanding the setup is important. The clock setup may be done somewhere
other than in the startup file so make sure you track it down.