Activating the XTAL output on K61 chip

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

Activating the XTAL output on K61 chip

1,026 Views
jimclay
Contributor II

We have built a custom board that has a MK61FN1M0CAA12 chip.  We want to use the OSC0 external crystal as the reference for the system clocks, but we cannot get the chip to activate the crystal, and by activate I mean put a DC voltage on the XTAL0 pin.  Without the DC voltage the crystal does not, of course, oscillate.  I have rechecked the layout and actual hardware and everything looks correct as far as I can tell.

We have done the following:

1) Verify that PORTA_PCR18 and PORTA_PCR19 (the pins that XTAL0 and EXTAL0 use) are 0.

2) Write 0xA2 to OSC_CR (enable the oscillator, introduce an 8 pF load).

3) Write 0x1C to MCG_C2 (crystal, high-gain, high frequency range)

4) Write 0xA0 to MCG_C1 (selects external reference as system clock source, sets FRDIV such that clock is in right range, enables oscillator)

I am doing all of these things from CodeWarrior using the Multilink Universal debugger.  I assume that the chip's clocking state machine can transition in this scenario.

The one clear mistake that we have made is to pick a 20 MHz crystal oscillator, which can't be divided down to 32 kHz.  We will replace it with a 16 MHz crystal, or some other appropriate frequency.  But seeing as how the crystal isn't even oscillating yet, I don't think that that is the problem at this point.

Any help would be greatly appreciated.

EDIT: I forgot to mention that the MCG_S[OSCINIT0] value never goes to 1, which is expected since the crystal never oscillates.

Message was edited by: Jim Clay

Labels (1)
Tags (2)
0 Kudos
4 Replies

710 Views
jimclay
Contributor II

zhaohuiliu,

Writing 0x2C instead of 0x1C did the trick.  The crystal is now being activated and oscillates nicely.  Thank you.

MCG_S[OSCINIT0] is still not being set, though.  Do you know what could cause that?

0 Kudos

709 Views
zhaohuiliu
NXP Employee
NXP Employee

hi Jim,

Are you using a while loop to check MCG_S[OSCINIT0] status, and the code is pending there for it is never set?  Please make sure that MCG swithed to FBE/BLPE mode correctly after you have seen the external clock activated. And also, you may share your code with us.

0 Kudos

710 Views
jimclay
Contributor II

How can we tell if it has transitioned to FBE/BLPE correctly?  I was just doing the register manipulations "by hand" via the Codewarrior debugger, so the debugger may not have updated the register value correctly.  I will try it via code soon.

0 Kudos

709 Views
zhaohuiliu
NXP Employee
NXP Employee

Hi Jim,

Comments for step 3)

a. should set to very high range 0x2C(high range is from 8-32MHz, if you have K61 datasheet, you can get these values)

b. make sure you have the feedback resistors as datasheet mentioned if you set high gain mode, otherwise, just use low gain mode

Commets for step 4)

a. Make sure MCG_S[OSCINIT0] is set before you want to change MCG mode by writing MCG_C1 with 0xA0

Feel free to let us know your result.