RC Oscillator - AP16

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RC Oscillator - AP16

2,036 Views
Roland
Contributor I
Hello!
 
I´m trying to programm an AP16 Controller with an RC Oscillator.
I use following values for the components:
Rext: 10k
Cext: 10pF
=> approximately 6MHz
 
On Pin "OSC2" I can measure a frequency from appr. 1,8MHz - is this the bus frequency?
In the main routine I toggle one Pin and I can measure a puls duration from 8,2µs.
 
I think with a OSC frequency from about 6MHz the bus frequency should be 1,5MHz (0,7µs) is this wrong?
I won´t use the PLL because the start up time is very long (270ms).
Have I a wrong initialization?
 
CONFIG1 = 0x01;
CONFIG2 = 0x08;
PCTL_PLLON=0;
 
Thank you for your help!
 
Roland
 
Labels (1)
0 Kudos
3 Replies

364 Views
bigmac
Specialist III
Hello Roland,
 
From the data sheet for the '908AP16, it would seem the Mask Option register (MOR) must also be programmed to select RC oscillator mode.  Since this is a flash location, it must be programmed when the application code is programmed.  This is in addition to setting CONFIG2 to determine the time base clock source.
 
When RC oscillator mode is selected, the OSC2 pin should output the bus frequency.
 
It seems you currently have a frequency error of about 20 percent from nominal value.  This sort of initial accuracy is probably expected, and there is also likely to be significant variation with voltage and temperature. Stray capacitance at the OSC1 pin would also affect the frequency.
 
Regards,
Mac
 
 
 
 
 
 
0 Kudos

364 Views
Roland
Contributor I
Hello Mac!
 
Sorry, I forgot to write the MOR register in my last message.
I initialized the MOR register as follow:
Code:
/* MOR: OSCSEL1=1,OSCSEL0=0 */const volatile MORSTR _MOR @0x0000FFCF = { 0xBF };
I think this is OK. 
But is it normal to have (for example) a puls duration from about 8µs when I toggle one pin?   
Code:
for(;;)   {    __RESET_WATCHDOG(); /* feeds the dog */       PTA_PTA6=~PTA_PTA6;      } /* loop forever */

Kind Regards
Roland
0 Kudos

364 Views
bigmac
Specialist III
Hello Roland,
 
The code associated with the output toggle loop should generate a square wave with a half period of 15 bus cycles.  If you are getting a half period of about 8.2 us, this is consistent with a bus frequency of about 1.8MHz, what you measured at the OSC2 pin.  For a bus frequency of 1.5 MHz, the square wave half period would be 10 us (a frequency of 50 kHz).  The value in the MOR would appear to be correct.
 
To get closer to the intended bus frequency, you might increase the R-value from 10k to 12k, applicable to the unit under test only.  Other devices of the same type may give quite different results, depending on parameter spread.
 
Regards,
Mac
 
0 Kudos