For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU.
This group is to exchange information to help users get started and learn how to use the devices.
PWM bug? - Johan Ingvast - Apr 11 5:08:31 2008
Hi
I am having trouble with the PWM module of AT91SAM7A3.
It seems as when I try to run the counter at the speed of the MAINCLK
(CPRE=0) sometimes the output pin gets inverted so that I get 98% duty
cycle when I really try to get 2%.
Strangely for some values of the duty cycle the output is ok, but for
other it is not.
I have looked in the errata but not found anything about this.
Any bells?
/johan
--
Johan Ingvast, PhD, CEO BioServo Technologies AB
Mob. +46 70 34 34 498 http://www.bioservo.com
Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )
Re: PWM bug? - djthurin - Apr 11 14:41:28 2008
Read the data sheet VERY carefully, especially the flow charts. You
are only allowed to write to the PWM at certain times. We found that
it is best to only update the PWM registers on an interrupt.
--- In A...@yahoogroups.com, Johan Ingvast
wrote:
>
> Hi
> I am having trouble with the PWM module of AT91SAM7A3.
> It seems as when I try to run the counter at the speed of the MAINCLK
> (CPRE=0) sometimes the output pin gets inverted so that I get 98% duty
> cycle when I really try to get 2%.
> Strangely for some values of the duty cycle the output is ok, but for
> other it is not.
>
> I have looked in the errata but not found anything about this.
>
> Any bells?
>
> /johan
> --
> Johan Ingvast, PhD, CEO BioServo Technologies AB
> Mob. +46 70 34 34 498 http://www.bioservo.com
> Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
>
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )Re: PWM bug? - andrewsterian - Apr 11 17:59:45 2008
--- In A...@yahoogroups.com, Johan Ingvast
wrote:
>
> Hi
> I am having trouble with the PWM module of AT91SAM7A3.
> It seems as when I try to run the counter at the speed of the MAINCLK
> (CPRE=0) sometimes the output pin gets inverted so that I get 98% duty
> cycle when I really try to get 2%.
> Strangely for some values of the duty cycle the output is ok, but for
> other it is not.
I'm guessing the SAM7A3 is similar to the SAM7S in that once the PWM
module is up and going, you have to change duty cycles by writing to
the CUPD register instead of the CDTY register, as you (probably) did
initially. Same goes for the period.
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )Re: Re: PWM bug? - Johan Ingvast - Apr 12 15:23:40 2008
Thanks for the input.
djthurin skrev:
> Read the data sheet VERY carefully, especially the flow charts. You
> are only allowed to write to the PWM at certain times. We found that
> it is best to only update the PWM registers on an interrupt.
I believe I've read the datasheets very carefully. Is there anything
particular you think about.
Thing is that the problem only seem to arise when I don't downscale the
clock for the counter. When I divide the clock by two or larger (with
the same duty cycle and period), it works perfectly.
According to the datasheets you should not have to do the updating on
interrupts (that is what you have the update registers for). Do you mean
that there is a bug in the PWM units?
/johan
>
> --- In A...@yahoogroups.com
, Johan
> Ingvast wrote:
> >
> > Hi
> > I am having trouble with the PWM module of AT91SAM7A3.
> > It seems as when I try to run the counter at the speed of the MAINCLK
> > (CPRE=0) sometimes the output pin gets inverted so that I get 98% duty
> > cycle when I really try to get 2%.
> > Strangely for some values of the duty cycle the output is ok, but for
> > other it is not.
> >
> > I have looked in the errata but not found anything about this.
> >
> > Any bells?
> >
> > /johan
> > --
> > Johan Ingvast, PhD, CEO BioServo Technologies AB
> > Mob. +46 70 34 34 498 http://www.bioservo.com
> > Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
>
> >
--
Johan Ingvast, PhD, CEO BioServo Technologies AB
Mob. +46 70 34 34 498 http://www.bioservo.com
Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )Re: Re: PWM bug? - Johan Ingvast - Apr 12 15:28:46 2008
Hi
andrewsterian skrev:
> --- In A...@yahoogroups.com
, Johan
> Ingvast wrote:
> >
> > I am having trouble with the PWM module of AT91SAM7A3.
> > It seems as when I try to run the counter at the speed of the MAINCLK
> > (CPRE=0) sometimes the output pin gets inverted so that I get 98% duty
> > cycle when I really try to get 2%.
> > Strangely for some values of the duty cycle the output is ok, but for
> > other it is not.
>
> I'm guessing the SAM7A3 is similar to the SAM7S in that once the PWM
> module is up and going, you have to change duty cycles by writing to
> the CUPD register instead of the CDTY register, as you (probably) did
> initially. Same goes for the period.
Writing to the CUPD register is what I do. I even wait for the counter
of to pass 0 and 1 as suggested in the errata.
/johan
--
Johan Ingvast, PhD, CEO BioServo Technologies AB
Mob. +46 70 34 34 498 http://www.bioservo.com
Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )Re: PWM bug? - djthurin - Apr 14 10:55:22 2008
Sounds like you have a different problem. I wanted the PWM to work
without using the update registers, so I could update period and duty
cycle at the same time.
I experienced the same symptoms as you, which is the random inverting
of the output signal.
--- In A...@yahoogroups.com, Johan Ingvast
wrote:
>
> Thanks for the input.
>
> djthurin skrev:
> > Read the data sheet VERY carefully, especially the flow charts. You
> > are only allowed to write to the PWM at certain times. We found that
> > it is best to only update the PWM registers on an interrupt.
> I believe I've read the datasheets very carefully. Is there anything
> particular you think about.
> Thing is that the problem only seem to arise when I don't downscale the
> clock for the counter. When I divide the clock by two or larger (with
> the same duty cycle and period), it works perfectly.
> According to the datasheets you should not have to do the updating on
> interrupts (that is what you have the update registers for). Do you
mean
> that there is a bug in the PWM units?
> /johan
>
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )Re: Re: PWM bug? - Johan Ingvast - Apr 14 11:19:09 2008
> Sounds like you have a different problem. I wanted the PWM to work
> without using the update registers, so I could update period and duty
> cycle at the same time.
Then I understand why you need an interrupt. Changing them both at the
same time is simply not supported!
--
Johan Ingvast, PhD, CEO BioServo Technologies AB
Mob. +46 70 34 34 498 http://www.bioservo.com
Pub. pgp sign.: http://www.md.kth.se/~ingvast/Ingvast_public_key.asc
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )