Forums

LPC2103 no shadow register for the PWM

Started by gaetanbarthelemy July 4, 2006
I have started working with a LPC2103 to control a Brushless motor. I
just remarked that this microcontroller doesn't use the shadow latch
mechanism which allows the new PWM values to take effect only at the
beginning of a new cycle.
I am thinking to generated a fast interrupt every time TC matches
MRx.3 (the one fixing the PWM period). The interrupt routine will then
update the PWM values. Unfortunately that has to be done as fast as
possible (less than 60 CPU cycles if I work at 60MHZ, do you think
that it is possible? or maybe someone has a better idea.

I guess that if this is not working, I will have to use to LPC2104 :-/

Thanks a lot for your advices

Gaetan

An Engineer's Guide to the LPC2100 Series

--- In l..., "gaetanbarthelemy"
wrote:
>
> I have started working with a LPC2103 to control a Brushless motor. >
I just remarked that this microcontroller doesn't use the shadow
> latch mechanism which allows the new PWM values to take effect only
> at the beginning of a new cycle.

The worst thing that can happen is if you are updating MRx to a lower
value when TC is between the old high value and the new low value. You
then won't get a match, and the output will stay low for this cycle.
If you update from a low to a high MRx value when TC is between them,
the output will just go high at the old low value, and the new value
takes effect in the next cycle.
When using several PWM outputs, combinations of these effects can occur
on the different outputs.

> I am thinking to generated a fast interrupt every time TC matches
> MRx.3 (the one fixing the PWM period). The interrupt routine will
> then update the PWM values. Unfortunately that has to be done as
> fast as possible (less than 60 CPU cycles if I work at 60MHZ, do
> you think that it is possible? or maybe someone has a better idea.

It might just be possible, especially if you use FIQ. Remember that
writing to the MRx registers take 7 clocks each (with APBDIV=1) because
they are behind the APB bridge.

Karl Olsen