LPC812 crystal with mcuXpresso SDK

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

LPC812 crystal with mcuXpresso SDK

622 Views
ctimm
Contributor I

Hi,

I can't seem to get an external 12MHz crystal working with the MCUXpresso SDK and its associated GUI tools. I can, however, make it work with the LPCopen driver library, but I'd rather stick with the MCUXpresso SDK since it seems like NXP will be phasing out or stopping support for the LPCopen SDK in the coming months or years (please correct me if I'm wrong) and I really, really don't want to mix two different driver libraries in the same project (everything else is working fine).

I'm ensuring that 'sys_osc' is the input to the SYSPLLCLKSEL mux, but what I'm seeing is that the PLL never locks. Additionally, the system oscillator is NOT bypassed (it is active), since I'm using the recommended crystal attached to both XTALIN and XTALOUT pins with the recommended 27pF bypass caps as well. If I hook up a scope, no activity is present across either side of the crystal.

Anyway, here's the code that is generated by MCUXpresso SDK:

/*!< Set up the clock sources */
 /*!< Set up IRC */
 POWER_DisablePD(kPDRUNCFG_PD_IRC_OUT); /*!< Ensure IRC_OUT is on */
 POWER_DisablePD(kPDRUNCFG_PD_IRC); /*!< Ensure IRC is on */
 POWER_DisablePD(kPDRUNCFG_PD_SYSOSC); /*!< Ensure Main osc is on */
 CLOCK_InitSysOsc(12000000U); /*!< Set main osc freq */
 CLOCK_Select(kSYSPLL_From_SysOsc); /*!< set sysosc to pll select */
 clock_sys_pll_t config;
 config.src = kCLOCK_SysPllSrcSysosc; /*!< set pll src */
 config.targetFreq = 60000000U; /*!< set pll target freq */
 CLOCK_InitSystemPll(&config); /*!< set parameters */
 CLOCK_SetMainClkSrc(kCLOCK_MainClkSrcSysPll); /*!< select pll clock for main clock */
 CLOCK_Select(kCLKOUT_From_SysOsc); /*!< select pll clock for CLKOUT */
 CLOCK_UpdateClkOUTsrc(); /*!< update CLKOUT src */
 CLOCK_SetCoreSysClkDiv(2U);
 CLOCK_SetClkDivider(kCLOCK_DivUsartClk, 1U); /*!< set UART div */
 SYSCON->UARTFRGDIV = 0; /*!> Set UARTFRGDIV */
 CLOCK_SetUARTFRGMULT(0U); /*!< Set UARTFRGMULT */
 /*!< Set SystemCoreClock variable. */
 SystemCoreClock = BOARD_BOOTCLOCKIRC12M_CORE_CLOCK;

Any advice? Thanks for your time.

Labels (1)
0 Kudos
2 Replies

500 Views
brendonslade
NXP TechSupport
NXP TechSupport

Can you provide the mex file and project export for your failing case?

It looks like you are using your own hardware, but can you confirm?

thanks

Brendon

0 Kudos

500 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Carter,

If the PLL code in LPCopen SDK runs fine on your target board, it means that hardware is okay, obviously the MCUXpresso SDK code for the PLL may have issue.

Pls check the register in debugger, for example, if the PIO0_8/PIO0_9 pins are configured as XTALin/XTALout pins, if the FCLKOUT is less than 100MHz, the FCCO clock frequency is in the range from 156 to 320MHz.

Hope it can help you

BR

XiangJun Rong

0 Kudos