I have some limited support for ATMEGA PWM here:
http://www.etantdonnes.com/Motes/AVR128timers.zip
MS
Ben Buckner wrote:
Hi,
is it possible to use pwm on micaz within tinyos?
are there free timers for pwm?
thx
Anton
Yes, the ATMega 128L used in the later mica* motes can generate several PWM
signals. You'll probably have to access the hardware directly; I'm not aware
of any TinyOS abstractions (previous to 2.0) that offer detailed enough
control over the counters to allow useful PWM generation. 2.0 may have
improved some, but it probably depends on whether you need more exotic
features like variable frequency or phase-correct PWM generation. The tricky
part I found was in working around the TinyOS counter usage, since the radio
component in particular has to have a timer. On the Mica2, which is pretty
similar to the MicaZ, I found Timer0 was the hardest to work around, and
Timer2 is reserved in the hardware design, so you can't use it under any
circumstances. Timer3 seems to be the safest to use, though Timer1 appears
to be fairly unmolested by most TinyOs functions too. Fortunately, 1 and 3
are the more sophisticated high resolution timers, so they can do about
anything that Timer0 or Timer2 can. In my app, I actually managed to do
phase-correct variable frequency PWM for a PD controller, counter driven 6
kHz ADC, and frequency measurement at the same time, so they can be fairly
flexible. Just remember to restore all the counter registers after you're
done with them.
See
http://www.avrfreaks.net/index.php?module=Freaks%20Devices&func=displayDev&o
bjectid=55
For hardware details.
Ben Buckner
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help