Or… MCUXpresso Clocks Configuration tutorial using OKdo E1 board.
Many of the examples available in the MCUXpresso SDK for lpcxpresso55s69 work just fine on the E1 board. “It was made that way”. However, those that use the BOARD_BootClockPLL150M() or BOARD_BootClock100M() clock functional groups hang up in the PLL initialisation routine. It doesn’t take much effort in a debug session to find that the code is stuck in a while() loop in the Clock driver (fsl_clock.c, function CLOCK_SetPLL0Freq()):
What is happening is the PLL is not locking. And it is not locking because it does not have a reference clock. And there is no reference clock because there is no crystal fitted to the board.
The workaround is really simple… provide a reference to PLL0 from the internal clock source instead of from the (missing) crystal. To maintain a 150 MHz output clock we need to adjust the PLL multiplier and divider values, and I show you how to do this in my video tutorial 3 MCUXpresso Clocks Config tutorial with OKdo E1 board
It is straightforward to create a new functional group in the MCUXpresso clocks tool (if you know that the Functional Groups Properties icon is the second one to the right of the Functional Groups: dropdown box):
I used the dialog to create a new functional group, and named it BOARD_BootClockFRO12_PLL_150MHz().
Since this functional group is going to use the PLL0, it is necessary to enable it, so the setting PLL0 Mode must be changed to ‘Normal’. After saving the new group [OK], we can edit it in the Clocks Diagram.
The change is to select the internal free-running oscillator fro_12m in the PLLCLKSEL multiplexer. The tool will highlight an error, because the existing PLL0 multiplier and divider generate an illegal output frequency. I fixed this with updated values – ( /8 * 200) to generate 300 MHz output. Finally, this is divided down into range with the PLL0_PDEC divider, yielding an output 150 MHz clock for the chip.
As always, I enable the CLKOUT pin, and output the main clock to a pin. Clearly, 150 MHz is too fast for the output pad, and I used a CLKOUTDIV of 200 and was able to measure 750 kHz on the clock output pin.
So that’s it really. That was an easy problem to find, and fix (when you know the Clocks tool). I know that these little tips and tricks on how to apply the MCUXpresso Config tools to these LPC55xx boards are popular, and so come back next week when I’ll start to set up the Pins on my OKdo E1 board for the weather station project.
If you’d like to see more videos, check out my embeddedpro YouTube channel for other tutorials about Cortex M33, LPC55S69, LPC55S16 and the OKdo E1 board.