Hello Ping,
To reproduce the problem, use a project example (I use periph_examples, but I don't think this is specific) from the LPCopen. I use the IAR version.
In the file board_sysinit.c add :
void Setup32k (uint32_t iFreq)
{
PLL_CONFIG_T pllConfig;
PLL_SETUP_T pllSetup;
PLL_ERROR_T pllError;
/* IOCON clock left on, this is needed is CLKIN is used. */
Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_IOCON);
/* Change clock to IRC to free PLL and configure it */
Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_IRC);
/* Select the PLL input to the EXT clock input */
Chip_Clock_SetSystemPLLSource(SYSCON_PLLCLKSRC_RTC);
/* Power down PLL to change the PLL divider ratio */
Chip_SYSCON_PowerDown(SYSCON_PDRUNCFG_PD_SYS_PLL);
/* Setup PLL configuration */
pllConfig.desiredRate = iFreq;
/* To the following is taken into account,
configure PLL_CONFIGFLAG_USEINRATE flag to 1 */
pllConfig.InputRate = 32000;
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 21, (IOCON_MODE_PULLUP |
IOCON_FUNC1 |
IOCON_DIGITAL_EN |
IOCON_INPFILT_OFF));
Chip_GPIO_SetPinDIROutput(LPC_GPIO, 0, 21);
/* Change clock source to IRC to be disconnected from PLL */
Chip_Clock_SetCLKOUTSource (SYSCON_CLKOUTSRC_MAINCLK, 1);
pllConfig.flags = PLL_CONFIGFLAG_FORCENOFRACT;
pllError = Chip_Clock_SetupPLLData(&pllConfig, &pllSetup);
if (pllError == PLL_ERROR_SUCCESS) {
pllSetup.flags = PLL_SETUPFLAG_WAITLOCK | PLL_SETUPFLAG_ADGVOLT;
pllError = Chip_Clock_SetupSystemPLLPrec(&pllSetup);
}
/* Change clock to PLL source */
Chip_Clock_SetMainClockSource(SYSCON_MAINCLKSRC_PLLOUT);
}
Change the board_SystemInit that way :
/* Set up and initialize hardware prior to call to main */
void Board_SystemInit(void)
{
/* Setup system clocking and muxing */
Board_SetupMuxing();
Board_SetupClocking();
Setup32k(96000000);
}
If you set a breakpoint before and after the Setup32k(96000000); function, you will see the software is locked here :

I also tried to add the following to the PLL_ERROR_T Chip_Clock_GetPllConfig function in the file pll_5410x.c:
Right after
/* Setup filtering */
pllFindSel(pllMultiplier, pllBypassFBDIV2, &pllSelP, &pllSelI, &pllSelR);
I add :
/* Specific setting for 32k crystal, from remark from Application Note */
if (finHz == 32768)
{
pllSelP = 6 ;
pllSelI = 1 ;
pllSelR = 0 ;
}
But no improvement from this.
Thanks for help.
Best Regards,
Flo