LPC812-MAX, LPCOpen problem with 12MHz XTAL, could not get it working

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by riscy00 on Wed May 06 08:13:34 MST 2015

LPCxpresso 7.7.2 (most recent) along with most recent library (installed last week). I use LINK2 board on SWD port. The setup working fine with UART, Systick and blinker working (derived from LPCOpen)

I have LPC812-MAX and wish to use external crystal as clock source instead of IRC.

My attempt, was to first power up using IRC and then switch over to external XTAL (12Mhz). I use LPCOpen Chip_SetupXtalClocking(); but ended up crashes (no LED blinking and debug provide error).

I copied over some code from Chip_SetupXtalClocking() to my routine as shown below, it crashed only when statement is excuted Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_SYSOSC);

I power down and power up (without debug) and the LED is not blinking, so the clock failed to get thro the PPL block.

I have two possibility,
> The onboard XTAL did not tick (defective hardware)..I have not checked XTALOUT yet (I'm on vacation).
> Undocumented procedure how to do this correctly.

i forget to add, I have changed the jumper SJ2 and SJ3 to connect XTAL to LPC812 on MAX board.

I have followed the datasheet to configure the port correctly.

void SysClock_LPC812_Swicth_To_XTAL(void)
//------------------------------------------------Enable the clock to the Switch Matrix
//-----------------------------------------------Disable the clock to the Switch Matrix to save power
     * @briefSets pull-up or pull-down mode for a pin
     * @parampIOCON: The base of IOCON peripheral on the chip
     * @parampin: Pin number
     * @parammode: Mode (Pull-up/Pull-down mode)
     * @returnNothing
     * @noteDo not use with pins PIO10 and PIO11.

//Code copied over from Chip_SetupXtalClocking(); to investigate source of crashes.

/* EXT oscillator < 15MHz */
Chip_Clock_SetPLLBypass(false, false);

/* Turn on the SYSOSC by clearing the power down bit */

/* Select the PLL input to the external oscillator */

// PPL code to be included once above is fixed (will not crash).

(1) Do you have example code that shown external clock is used.
(2) Is there other element missing from above code?