Using external reference

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using external reference

ソリューションへジャンプ
1,242件の閲覧回数
jimclay
Contributor II

We have built a custom board that has a MK61FN1M0CAA12 chip.  We want to use the OSC0 external crystal (32 MHz) as the reference for the system clocks and we are using the example outlined in section 25.5.3.1 of the K61 reference manual (rev 2), "Example 1: Moving from FEI to PEE Mode with OSCO..." as a guide.  The code is below-

  // Enable the external oscillator, and give it an 8pF load

  OSC_CR = 0xA2;

  // Select the external oscillator as the reference, and set it to

  // Very high frequency range oscillator and high gain.

  MCG_C2 = 0x2C;

  // Wait for the crystal to finish initializing

  while ((MCG_S & 0x02) == 0);

  // Select crystal as source for MCGOUTCLK and FLL, divide it by 1024 to get it to 32 kHz

  MCG_C1 = 0xA8;

  // Wait for the FLL to use the external clock

  while ((MCG_S & 0x10) != 0);

It hangs at this point.  I have verified that the oscillator is running at 32 MHz, as expected.  Am I doing something wrong in the code?

タグ(3)
0 件の賞賛
返信
1 解決策
1,028件の閲覧回数
jimclay
Contributor II

The problem turned out to be the high-gain setting for the external crystal.  I changed the MCG_C2 setting to 0x24, and that fixed the problem.

We have a 1 MOhm load resistor which I thought made it so that you were supposed to use the high-gain setting, but I guess not.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,029件の閲覧回数
jimclay
Contributor II

The problem turned out to be the high-gain setting for the external crystal.  I changed the MCG_C2 setting to 0x24, and that fixed the problem.

We have a 1 MOhm load resistor which I thought made it so that you were supposed to use the high-gain setting, but I guess not.

0 件の賞賛
返信