K65 using external oscillator of 24MHz in MQX/KSDK

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

K65 using external oscillator of 24MHz in MQX/KSDK

Jump to solution
828 Views
annamol
Contributor IV

Hi,

 

I have a custom board with K65 and a 24MHz oscillator is used in our design instead of 16MHz in eval kit reference design. I tried using MQX as well as KSDK to get the board up and running. The code gets flashed via Jlink, but is stuck in MCG loop (screenshot attached) where it tries to set frequency from external oscillator. I made the following changes in bsp and bsp_cm files, but no change is happening.

 

 #define CPU_OSCER_CLK_HZ_CONFIG_0    24000000UL /* System OSC external reference clock frequency in clock configuration 0 */

 As a next step, I changed from FEI to FBI and then to FBE, PBE,PEE etc from __pe_initialize_hardware in bsp. But no change. It would be great if some one can point out what I am doing wrong and how to get the system up and running with this external oscillator/internal oscillator. 

 

I even tried with KSDK, it is getting stuck in hardware_init()

Labels (1)
0 Kudos
1 Solution
662 Views
annamol
Contributor IV

Hi,

Thanks for the reply. Got it working. Had to adjust C5_PRDIV0 to 3 in mqx to get 8MHz for PLL reference. Now the code is flashing. 

View solution in original post

0 Kudos
2 Replies
662 Views
soledad
NXP Employee
NXP Employee

Hello Alex,

Could you please confirm the following configuration in board.c file?

/* OSC0 configuration. */
#define OSC0_XTAL_FREQ 24000000U
#define OSC0_SC2P_ENABLE_CONFIG  false
#define OSC0_SC4P_ENABLE_CONFIG  false
#define OSC0_SC8P_ENABLE_CONFIG  false
#define OSC0_SC16P_ENABLE_CONFIG false
#define MCG_HGO0   kOscGainLow
#define MCG_RANGE0 kOscRangeVeryHigh
#define MCG_EREFS0 kOscSrcOsc

/* EXTAL0 PTA18 */
#define EXTAL0_PORT   PORTA
#define EXTAL0_PIN    18
#define EXTAL0_PINMUX kPortPinDisabled

/* XTAL0 PTA19 */
#define XTAL0_PORT   PORTA
#define XTAL0_PIN    19
#define XTAL0_PINMUX kPortPinDisabled


Have a great day,
Sol

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

0 Kudos
663 Views
annamol
Contributor IV

Hi,

Thanks for the reply. Got it working. Had to adjust C5_PRDIV0 to 3 in mqx to get 8MHz for PLL reference. Now the code is flashing. 

0 Kudos