EmbeddedRelated.com
Forums

Help on PWM basic code

Started by madbaxyh April 18, 2012
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.



An Engineer's Guide to the LPC2100 Series

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
>

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
>



I made a doc with some pics:
https://docs.google.com/document/d/1hcYva3DO3pqDP8PF_WoT15I-lBlvV_wW5dHEwy_nmEY/edit

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?
>

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...

any ideas?

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...

any ideas?