Switch between external crystal oscillator and fro on LPC546xx

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

Switch between external crystal oscillator and fro on LPC546xx

Jump to solution
1,461 Views
jerrycai
Contributor I

Dear

I have two questions on switching between external crystal osc and internal fro.

MCU: LPC54628

1. In defalut, LPC54628 uses intenal FRO 12M  on reset. if I want to switch to external osc(XTALin) as CLK_IN, what procedure should be followed to promise the stable.  Is there any status we can check the Eternal OSC works well.

2. What will be occured when external crystal osc is failed, does it switch to internal FRO automatically by MCU? 

Labels (1)
0 Kudos
1 Solution
1,184 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Jerry,

I currently don't have LPC54628 board but I make a quick test on my LPC54608 board.

I use 12M external OSC, PLL, output System clock 48M, main_clock 48M. external OSC works well from my side.

clock diagram:

pastedImage_1.png

The accordingly initialization code is attached.

If your external osc is not workable, you can't even debug code. for example, during clock initialization, when you execute/debug code of switch MAIN_CLK to  to system PLL, debug fails and loses connection.

To check clock setting, you can set CLKOUTSELA register to orient clk_in or main_clk or pll_clk to CLKOUT pin, measure this pin with scope. see if the output is correct.

if your external OSC configuration is wrong, normally the code will be stuck there during running; if you are doing debug, you will see debug lose connection during clock configuration code. The popped up error message such as " Target error from register access",etc.

It will not switch to internal FRO automatically by MCU when external crystal osc is failed.


Have a great day,
Jun Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
1,185 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Jerry,

I currently don't have LPC54628 board but I make a quick test on my LPC54608 board.

I use 12M external OSC, PLL, output System clock 48M, main_clock 48M. external OSC works well from my side.

clock diagram:

pastedImage_1.png

The accordingly initialization code is attached.

If your external osc is not workable, you can't even debug code. for example, during clock initialization, when you execute/debug code of switch MAIN_CLK to  to system PLL, debug fails and loses connection.

To check clock setting, you can set CLKOUTSELA register to orient clk_in or main_clk or pll_clk to CLKOUT pin, measure this pin with scope. see if the output is correct.

if your external OSC configuration is wrong, normally the code will be stuck there during running; if you are doing debug, you will see debug lose connection during clock configuration code. The popped up error message such as " Target error from register access",etc.

It will not switch to internal FRO automatically by MCU when external crystal osc is failed.


Have a great day,
Jun Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos