PLL configuration

4 replies [Last post]
Linas
Offline
Joined: 2012-09-19
Posts: 22

Hi,

I would like to dinamically change PLL clock in the LPC17xx MCU. During the program flow I would like to
reduce clock from 80 MHz to 30 MHz. Is it safe? Maybe someone had a similar task.

Best,

Linas

5
Your rating: None Average: 5 (1 vote)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wellsk's picture
wellsk
Offline
Joined: 2011-05-17
Posts: 567

Are you using the PLL to drive the system clock (base clock for CPU divider and peripherals)? And are you using the 175x/6x or 177x/8x family?

Changing the PLL while the system is actively using it isn't something I would recommend. It might work, but changing the PLL rate usually has some delay involved and can stall or cause problems with devices that use that clock (for example,

If you really need to change the PLL rate, it's best to switch the system clock to a safe clock (main oscillator or IRC), then adjust the PLL and wait for PLL lock, and then switch the system clock back to the PLL. Because the PLL rate changed, any peripherals you use will need to be re-setup for the new clock.

A better alternative would be to keep the PLL clock rate at 80MHz and adjust the CPU clock divider. It won't get you an exact 30MHz, but you can easily get 40MHz or 26.67MHz. You can also trying bumping up the PLL rate to 120MHz and using CPU dividers of 2 and 4 for fast switching between 60Mhz and 30MHz. For the 175x/6x family, the peripheral clock rate is based on the CPU rate and it's divider, while the 177x/8x peripheral clock is based directly on the system clock (ie, PLL out) and isn't altered by the CPU divider.

Kevin Wells

NXP Semiconductors

Kevin Wells

NXP Semiconductors

Linas
Offline
Joined: 2012-09-19
Posts: 22

Yes I am using PLL to drive CPU and peripherals clock. So, if I will change CPU divider, do I need to re-setup peripherals?

Yes I am going to use LPC1778. For now I am working with LPC1756.

Best,

Linas

Linas
Offline
Joined: 2012-09-19
Posts: 22

Oh yes I see that LPC1778 peripheral gets clock from the PLL. So, in case of LPC1778 I can configure CPU divider dynamically. Are there any special sequence to do that?

Best,

Linas

Linas
Offline
Joined: 2012-09-19
Posts: 22

But I noticed one thing regarding changing CPU divider.

LPC_SC->CCLKCFG = CCLKCFG_Val; /* Setup Clock Divider */
/* Periphral clock must be selected before PLL0 enabling and connecting */

So, in case LPC1778 I want to change dynamically CPU clock divider I need to disable and disconnect PLL. Can I change
CPU divider without disabling PLL during application runtime?

Linas

feedback