Dan,
Thanks for your advice. After doing some further code development, I’ve implemented some functions that attempt to perform a safe transition between one PLLCLK freq to the next. To do this, my code does the following:
/**
* To set PLLCLK as clk source, or otherwise change the current PLL clk
* frequency, do the following:
*
* 1. Set OSCCLK as clk source, and enable/keep enabled the PLL.
* 2. Calculate (in floating point) what the new PLL Clk freq (PCF) will
* be using OSCCLK, and params \c cRGSYNRVal and \c cRGREFDIVVal.
* 3. convert the new PLL Clk Freq (PCF) to an integer value.
* 4. Perform a test to ensure that the new PCF is indeed an integer and
* is between the min and max values allowed for this device. If the
* test fails, ensure OSCCLK is made the clk source.
* 5. If the test passes, allow the SYNR and REFDIV values to get updated
* with the supplied params.
* 6. Do a test to wait for CRGFLG to get set, if sucessful, indicates
* PLL has entered lock. If the test fails (ie: a timeout is
* reached prior to lock), it means that there's a problem with the
* PLL entering into lock.
* 7. Upon success of the PLL lock test, Make PLLCLK the clk source.
* Update the CRG private data struct
* with the new PLL clk freq value.
*/
I perform some tests using my ‘DP256 jumpered for EVB and running the code in RAM using DBug-12. Things work correctly up to the point that I try to make changes to SYNR, REFDIV and finally SCI0BR. Anything other than DBug-12’s preset config that uses the PLL with BUSCLK of 24 MHz causes pandemonium in the terminal window. Upon attempting to abort operation using *XIRQ, I can dig into the three registers mentioned above and determine that they are indeed being set to what I feel are the correct parameters (I’ve included lists of values below for reference). Unfortuantely the SCI output/input doesn’t want to behave like its supposed to.
SYNR Value REFDIV Value Corresponding PLLCLK/2 Freq
0 1 8
8 15 9
4 7 10
10 15 11
2 3 12
12 15 13
6 7 14
14 15 15
0 0 16
16 15 17
8 7 18
18 15 19
4 3 20
20 15 21
10 7 22
22 15 23
2 1 24
I haven’t yet done any verification using SCM and the crystal monitor, to be honest I don’t have much direction or info at this point as to how to proceed validating my crystal and PLL’s operation using the functionality of the SCM or crystal monitor. As for ensuring that the crystal is producing a stable frequency, what should I measure? Will a scope probe (properly connected; what connections do I make and where?) reveal any trouble with the crystal?
Eric