Hi All,
I am currently looking at using the RTC 32KHz oscillator on an LPC11u68 to run the main clock and when I switch the system PLL source to SYSCTL_PLLCLKSRC_RTC32K the system hangs and I need to use ISP reset to clear the device to reconnect. I have initially got the system running off an external oscillator (also works from IRC oscillator) and then when I try to switch to the slow clock things break.
I am using the LPCOpen library with the following code to switch the main clock:
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC); Chip_Clock_EnableRTCOsc(); Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN); Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_RTC32K);
I am using the call to void Chip_SetupXtalClocking(void) to set the initial clock (that seems to work fine).
Is there something I am missing? According to the datasheet, this is all I need to do to use the RTC 32 KHz oscillator for the system clock.
Cheers,
Shane
Solved! Go to Solution.
Hello Shane,
What board are you using? It should be working with those lines that you added. I took periph_clkout example from LPCOpen (LPCXpresso 11u68 Board Rev C) and made next modifications on main function:
SystemCoreClockUpdate();
Board_Init();
Board_LED_Set(0, false);
/* Enable clock for RTC */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC);
Chip_Clock_EnableRTCOsc();
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_RTC32K);
Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN);
/* Enable and setup SysTick Timer at a 100Hz rate */
SysTick_Config(SystemCoreClock / 100);
/* WDT oscillator freq = 0.6MHz divided by 64 = 9.375khz */
Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);
/* Enable the power to the WDT */
Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_WDTOSC_PD);
/* Configure PIN0.1 for CLKOUT */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 1, IOCON_FUNC1);
/* Setup CLKOUT pin for specific clock with a divider of 1 */
Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_MAINSYSCLK, 1);
while (1) {
}
Then, I was able to measure the 32.768 kHz on P0.1 pin:
So you can give a try to do same modifications on periph_clkout example.
Hope it helps!
Regards,
Isaac
Hello Shane,
What board are you using? It should be working with those lines that you added. I took periph_clkout example from LPCOpen (LPCXpresso 11u68 Board Rev C) and made next modifications on main function:
SystemCoreClockUpdate();
Board_Init();
Board_LED_Set(0, false);
/* Enable clock for RTC */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC);
Chip_Clock_EnableRTCOsc();
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_RTC32K);
Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN);
/* Enable and setup SysTick Timer at a 100Hz rate */
SysTick_Config(SystemCoreClock / 100);
/* WDT oscillator freq = 0.6MHz divided by 64 = 9.375khz */
Chip_Clock_SetWDTOSC(WDTLFO_OSC_0_60, 64);
/* Enable the power to the WDT */
Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_WDTOSC_PD);
/* Configure PIN0.1 for CLKOUT */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 1, IOCON_FUNC1);
/* Setup CLKOUT pin for specific clock with a divider of 1 */
Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_MAINSYSCLK, 1);
while (1) {
}
Then, I was able to measure the 32.768 kHz on P0.1 pin:
So you can give a try to do same modifications on periph_clkout example.
Hope it helps!
Regards,
Isaac