Hi!
I'm new in LPC55S6x series MCUs. I'm using LPCXpresso55S69 (Rev. A2). I'm started write some system startup code as I did it before in my old LPC17xx library. I prefer my own source codes instead of the SDK.
I had some problem during system init, when the Main Clock and the System Clock is going to be switched from the default FRO 12MHz (AHBCLKDIV=0 (divide by 1)) to PLL0 25MHz (AHBCLKDIV=0 (divide by 1)). PLL setup is correct and it's stability is checked after configuration. I do the Internal Voltage configuration and Flash Acceess Time setting as it is described by the User Manual in 14.4, on page 287. When I set the Main Clock Select A and B MUXes (MAINCLKSELA, MAINCLKSELB) and the System Clock Divider (AHBCLKDIV), the program jumped to HardFault. I've tried several PLL setups and register writing orders, but I had got HardFault at the end around setting MUXA, MUXB and AHBCLKDIV.
After some debugging I found that, some of the register reset values are different from the values written in the user manual:
MAINCLKSELA: SEL=3 (FRO 96M), datasheet: SEL=1 (FRO 12M)
MAINCLKSELB: SEL=0 (Main Clock A), datasheet: SEL=0 (Main Clock A)
AHBCLKDIV: DIV=1 (divide by 2), datasheet: DIV=0 (divide by 1)
So, the system clock is 48MHz instead of 12MHz!
I've also checked the Flash Access Time setting in FMCCR, FLASHTIM=4 (5 system clocks flash access time (for system clock rates up to 55 MHz)). This value corresponds to the 48MHz system clock value.
I've checked an SDK examle "lpcxpresso55s69_lpadc_polling" for comparing my code. The BOARD_BootClockPLL150M() starts with:
CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */
This line would have saved me a lot of time if I had looked at the SDK examplein in time, but I don't like solutions "just for sure". So I would like to understand what the situation is.
Does anyone had this issue earlier, or maybe am I thinking somethin wrong?