2012-11-25, 22:57:21
(2012-11-25, 18:57:59)Mikael Gustavsson Wrote: If the measured frequency is 921kHz, fcy=3685000 is correct.
Have you configured PPS correctly?
hmm. What do you mean by configuring PPS correctly if i use PORTB => RB2 default pins as outputs ?
Isn't PPS = "Peripheral Pin Select" and is used only to map special features to a specific pin, for e.g. UART2 module to RP2 pin (would be the same pin as RB2). For now i only have tried to get the Oscillator configured correctly without PLL. I haven't tried yet further with UART pin mappings...
About the frequency, i saw this in the data sheet.
DOZE<2:0>: Processor Clock Reduction Select bits
111 = FCY/128
110 = FCY/64
101 = FCY/32
100 = FCY/16
011 = FCY/8 (default)
010 = FCY/4
001 = FCY/2
000 = FCY/1
Well, 3685000/8 is approx. 460KHz... but DOZE is maybe not enabled so i think this is not the thing in my case...
Then i saw this:
bit 7-6 PLLPOST<1:0>: PLL VCO Output Divider Select bits (also denoted as ‘N2’, PLL postscaler)
11 = Output/8
10 = Reserved
01 = Output/4 (default) => I ASSUME output means Fosc frequency (7.37Mhz)
00 = Output/2
Where am i actually setting these 2 bits in your code. If these bits equals 1 in decimal value, then the output would be 7.37MHz/4 which again is near 2Mhz, so why do you say that the measured 921KHz is correct with FCY value of 3685000, what is the equation for this result ?