David Brown wrote:
On one system I made, I had similar requirements - I needed to generate a
baud clock (uarts tolerate up to 5% difference between the sender and the
transmitter), and had a 32kHz crystal on the timer pins as a reference. I
made a very simple regulator in software. I aimed to drive the DCO at a
particular frequency (4.8 MHz, or something like that), and set up a timer
interrupt that should occur regularly (based on the crystal timer). I ran
timer B off the DCO frequency, and on the timer interrupt I compared the
measured timerB counts to the expected one and adjusted the DCO accordingly.
It stabalised to within a fraction of a percent accuracy after a few tenths
of a second, and the program then re-used timerB for other purposes. Every
now and again, it would redo the calibration to take into account
temperature or voltage variations.
there is an application note from TI covering the software FLL.
code based on it can be found in the examples, see "timerA_uart"
they use timer_A, ACLK is on CCR1, DCOCLK sources the timer clock.
then there is the other approach: adjust all your time constants based
on a reference measurement. but don't touch MCLK,SMCLK,ACLK. the USART
could be adjusted too.
adjusting the FLL with the first method has the disadvantage that you
have to switch RSELs which in turn makes large jumps in the system
frequency which is bad for algorithms that need a continuous time. the
second approach does not "jump" and allows a smooth regulation, but its
range is limited (has to fit the 16 bits of the timer for all temperatures)
chris
Background:
Steve has pretty much convinced me of the power savings advantages of
DCO, but I worried about providing a reliable and sufficiently accurate
clock for a 115200 serial line. For this purpose, I was using a
3.684MHz crystal. Although Fredic reports reports success with DCO and
the FLL algorithm (not applicable to the F161x parts), I am still
concerned about part variation.
The solution I am considering is to use one of the DACs to drive Rosc.
The initial setting of DAC would be 2.6V, midway beween 2.2 and 3V. Rosc
would be either 200k or 100k depending on frequency requirements of the
application. These values are available at 25ppm from KOA Speer as 0805
parts (RN32ALTD1003B25, RN32ALTD2003B25). The 100k resistor would allow
me to go to 7.368MHz.
In my application, I am also using a DS1390 RTC with battery backup,
which outputs a 32768Hz signal connected to TB0.
The general idea is to use RSELx and DCOx to get into the ballpark, and
then use the DAC to fine tune the frequency.
Is this stupid, overkill, or what?
Flames welcome.
Garst
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users