changing PLL multiplier on fly - PLLCFG (MSEL)
2006-01-20 by Vimal Amin
Yahoo Groups archive
Index last updated: 2026-04-28 23:31 UTC
Thread
2006-01-20 by Vimal Amin
I need LPC2132 to run @32MHz for 2mSec (my time measurement periode) and then drop speed to 4MHz for 100mSec. This cycle continues forever. Is it possible to change MSEL while running? I am afraid of Capture range, Locking range and stabilizing period etc. Anybody experianced with this? Vimal Amin
2006-01-20 by Karl Olsen
--- In lpc2000@yahoogroups.com, "Vimal Amin" <vimal19542000@y...> wrote: > > I need LPC2132 to run @32MHz for 2mSec (my time measurement periode) > and then drop speed to 4MHz for 100mSec. This cycle continues > forever. > Is it possible to change MSEL while running? I am afraid of Capture > range, Locking range and stabilizing period etc. > > Anybody experianced with this? Not reprogramming the PLL, but you can connect and disconnect it to switch between the crystal frequency and the PLL frequency. This switching can be done instantaneously, when you just leave the PLL running all the time. I have used this as a workaround for the old buggy bootloader on LPC2114 that didn't work at high cclk speeds. Btw, the PLL input requires at least 10 MHz, so you can't go down to 4 MHz. SYS->PLLCON = 0x01; /* PLL = enabled, not connected */ SYS->PLLFEED = 0xAA; SYS->PLLFEED = 0x55; ... running at slow Fosc speed SYS->PLLCON = 0x03; /* PLL = enabled and connected */ SYS->PLLFEED = 0xAA; SYS->PLLFEED = 0x55; ... running at full PLL speed Karl Olsen
2006-01-20 by Digital Systems, Partner
Thanks Karl. You are right. But there is a bit, PLOCK. I am not very clear about application. Can I do as follows? Disable PLL (Not just switch). I neet to conserve power. And while enabling again, I check this bit again befor switching to PLL again. Regards Vimal [Non-text portions of this message have been removed]
2006-01-20 by Karl Olsen
---- Original Message ----
From: "Digital Systems, Partner" <dsystem@...> To: <lpc2000@yahoogroups.com> Sent: Friday, January 20, 2006 6:42 PM Subject: Re: [lpc2000] Re: changing PLL multiplier on fly - PLLCFG (MSEL) > But there is a bit, PLOCK. I am not very clear about application. > > Can I do as follows? > Disable PLL (Not just switch). I neet to conserve power. And while > enabling again, I check this bit again befor switching to PLL again. I guess you can. Other than the temporary PLL disconnecting, I have only done the normal PLL enabling at startup: SYS->PLLCFG = 0x23; /* P=2, M=4 */ SYS->PLLCON = 0x01; /* Enable PLL */ SYS->PLLFEED = 0xAA; SYS->PLLFEED = 0x55; while (!(SYS->PLLSTAT & 0x400)); /* Wait until PLOCK */ SYS->PLLCON = 0x03; /* Enable and connect PLL */ SYS->PLLFEED = 0xAA; SYS->PLLFEED = 0x55; To conserve power, disconnect and disable PLL, and enter Idle mode as much as possible. Powerdown mode would be better, but only an external interrupt or reset will bring you out of it. When waking up, enable but not yet connect the PLL. According to the datasheet, the PLL takes 100 usec to lock. Don't trust this number, wait until the PLOCK bit is set, which tells that it has locked. While you wait for it to lock, you can continue working at the low clock. If you have nothing useful to do at the low speed, you'll conserve most power by enabling the PLL interrupt so that you get an interrupt when PLOCK is set, and while waiting for the interrupt, you enter Idle mode. When the PLL has locked, your PLL interrupt handler is called, and in that you connect the PLL, and start the real processing. This means that the CPU is idle, not active, during the ~100 usec lock time. Also remember to disable all unused peripherals in PCONP, and don't pull any P1.x pins low (neither by external circuitry, nor by having them as GPIO outputs that are low), as there are permanent internal pull-ups on these pins. Karl Olsen
2006-01-20 by Tom Walsh
Karl Olsen wrote: >---- Original Message ---- >From: "Digital Systems, Partner" <dsystem@...> >To: <lpc2000@yahoogroups.com> >Sent: Friday, January 20, 2006 6:42 PM >Subject: Re: [lpc2000] Re: changing PLL multiplier on fly - PLLCFG >(MSEL) > > > >>But there is a bit, PLOCK. I am not very clear about application. >> >>Can I do as follows? >>Disable PLL (Not just switch). I neet to conserve power. And while >>enabling again, I check this bit again befor switching to PLL again. >> >> > >I guess you can. Other than the temporary PLL disconnecting, I have only >done the normal PLL enabling at startup: > >SYS->PLLCFG = 0x23; /* P=2, M=4 */ >SYS->PLLCON = 0x01; /* Enable PLL */ >SYS->PLLFEED = 0xAA; >SYS->PLLFEED = 0x55; >while (!(SYS->PLLSTAT & 0x400)); /* Wait until PLOCK */ >SYS->PLLCON = 0x03; /* Enable and connect PLL */ >SYS->PLLFEED = 0xAA; >SYS->PLLFEED = 0x55; > > >To conserve power, disconnect and disable PLL, and enter Idle mode as much >as possible. Powerdown mode would be better, but only an external interrupt >or reset will bring you out of it. > >When waking up, enable but not yet connect the PLL. According to the >datasheet, the PLL takes 100 usec to lock. Don't trust this number, wait >until the PLOCK bit is set, which tells that it has locked. > > > I am also considering varying the clock to save power, won't this raise havoc with the peripherials? AFAICT, the uart baudrate, timer interrupt values, etc., all will have to be reprogrammed to match the new PCLK value? Regards, TomW -- Tom Walsh - WN3L - Embedded Systems Consultant http://openhardware.net, http://cyberiansoftware.com "Windows? No thanks, I have work to do..." ----------------------------------------------------
2006-01-21 by Karl Olsen
---- Original Message ----
From: "Tom Walsh" <tom@...> To: <lpc2000@yahoogroups.com> Sent: Friday, January 20, 2006 10:47 PM Subject: Re: [lpc2000] Re: changing PLL multiplier on fly - PLLCFG (MSEL) > I am also considering varying the clock to save power, won't this > raise havoc with the peripherials? AFAICT, the uart baudrate, timer > interrupt values, etc., all will have to be reprogrammed to match the > new PCLK value? Yes. You can reduce havoc by switching between PLL multiplier=4 and APBDIV=4, and PLL disabled and APBDIV=1. Except for a little disturbance during the switching, the peripherals continue unchanged. Karl Olsen
2006-01-21 by Digital Systems, Partner
PLL settings for power conservation... Thanks a lot to Karl to confirm my assumptions. Warm regards Vimal Amin