Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | LPC2148 setting Uart0 at 12mhz pclk - not working


Advertise Here

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

LPC2148 setting Uart0 at 12mhz pclk - not working - ssonderhoff - Feb 7 11:41:36 2010

I am running the lpc2148 at a low clock speed of 12 mhz to reduce power usage. This is working, the power consumption is down and a light blinks at the correct rate. for each speed I reset the Uart0 parameters to take the pclk into account (code below)

the PLL_int(code below) sets processor to 12mhz(slow).

At 60mhz Everything is working fine fine and I can read the output debug text without any problem.

At 12 mhz it outputs nothing but garbage, I have tried setting to different baud rates from low to high with the same result.

The Uart settings were determined using the NXP lpc2000 calculator

I believe that I have faithfully followed the data sheet. Can anyone tell me what I am missing?
Thanks,
Stefan

//*********CODE***********
void PLL_init(int speed) // sets clock speed
{

if(speed==fast){PLLCFG=0x24;} // Setting Multiplier(5) and Divider(4) so 5xosc (12mhz) = 60 mhz
else{PLLCFG=0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and Divider(8) 1xosc = 12mhz: pclk = cclk

feed();

PLLCON=0x1; // Enabling the PLL
feed();

while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set frequency

PLLCON=0x3;// Connect the PLL as the clock source
feed();

}
//*******************************************************************
void setuart(int speed) //sets up UART0
{

if(speed==fast)
{
U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
U0DLM = 0x00; //msb = 0
U0DLL = 0x20; //lsb = 32
U0FCR = 0x07; // enable and reset
U0LCR = 0x03; // 8 bit character length
VICIntEnClr = 0x00000040;
U0IER = 0x00;
}
else //initialize uart0 115200 buad 12mhz
{
U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
U0DLM = 0x00; //msb = 0
U0DLL = 0x6; //lsb = 6
U0FDR = 0xC1; //fract divider divaddval(3:0) = 1 & mulval(7:4) = 12
U0FCR = 0x07; // enable and reset
U0LCR = 0x03;
VICIntEnClr = 0x00000040;
U0IER = 0x00;
}

}

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 8 15:46:34 2010

Perhaps I should re-state the question. The PLLCFG and UART) settings seem to be correct - Please let me know if you can see some mistake - Is there anything else that could affect UART0 after a cclk change. The port is active, but the output is garbage. Any thoughts would be welcome.

--- In l...@yahoogroups.com, "ssonderhoff" wrote:
>
> I am running the lpc2148 at a low clock speed of 12 mhz to reduce power usage. This is working, the power consumption is down and a light blinks at the correct rate. for each speed I reset the Uart0 parameters to take the pclk into account (code below)
>
> the PLL_int(code below) sets processor to 12mhz(slow).
>
> At 60mhz Everything is working fine fine and I can read the output debug text without any problem.
>
> At 12 mhz it outputs nothing but garbage, I have tried setting to different baud rates from low to high with the same result.
>
> The Uart settings were determined using the NXP lpc2000 calculator
>
> I believe that I have faithfully followed the data sheet. Can anyone tell me what I am missing?
> Thanks,
> Stefan
>
> //*********CODE***********
> void PLL_init(int speed) // sets clock speed
> {
>
> if(speed==fast){PLLCFG=0x24;} // Setting Multiplier(5) and Divider(4) so 5xosc (12mhz) = 60 mhz
> else{PLLCFG=0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and Divider(8) 1xosc = 12mhz: pclk = cclk
>
> feed();
>
> PLLCON=0x1; // Enabling the PLL
> feed();
>
> while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set frequency
>
> PLLCON=0x3;// Connect the PLL as the clock source
> feed();
>
> }
> //*******************************************************************
> void setuart(int speed) //sets up UART0
> {
>
>
> if(speed==fast)
> {
> U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> U0DLM = 0x00; //msb = 0
> U0DLL = 0x20; //lsb = 32
> U0FCR = 0x07; // enable and reset
> U0LCR = 0x03; // 8 bit character length
> VICIntEnClr = 0x00000040;
> U0IER = 0x00;
> }
> else //initialize uart0 115200 buad 12mhz
> {
> U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> U0DLM = 0x00; //msb = 0
> U0DLL = 0x6; //lsb = 6
> U0FDR = 0xC1; //fract divider divaddval(3:0) = 1 & mulval(7:4) = 12
> U0FCR = 0x07; // enable and reset
> U0LCR = 0x03;
> VICIntEnClr = 0x00000040;
> U0IER = 0x00;
> }
>
> }
>

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Sutton Mehaffey - Feb 8 17:14:40 2010

What's your Fosc? If it is 12, I don't think you need to activate PLL0,
if that's your CCLK speed.

ssonderhoff wrote:
>
>
> Perhaps I should re-state the question. The PLLCFG and UART) settings
> seem to be correct - Please let me know if you can see some mistake - Is
> there anything else that could affect UART0 after a cclk change. The
> port is active, but the output is garbage. Any thoughts would be welcome.
>
> --- In lpc2000@yahoogroups .com ,
> "ssonderhoff" wrote:
> >
> > I am running the lpc2148 at a low clock speed of 12 mhz to reduce
> power usage. This is working, the power consumption is down and a light
> blinks at the correct rate. for each speed I reset the Uart0 parameters
> to take the pclk into account (code below)
> >
> > the PLL_int(code below) sets processor to 12mhz(slow).
> >
> > At 60mhz Everything is working fine fine and I can read the output
> debug text without any problem.
> >
> > At 12 mhz it outputs nothing but garbage, I have tried setting to
> different baud rates from low to high with the same result.
> >
> > The Uart settings were determined using the NXP lpc2000 calculator
> >
> > I believe that I have faithfully followed the data sheet. Can anyone
> tell me what I am missing?
> > Thanks,
> > Stefan
> >
> > //*********CODE* ********* *
> > void PLL_init(int speed) // sets clock speed
> > {
> >
> > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> Divider(4) so 5xosc (12mhz) = 60 mhz
> > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> Divider(8) 1xosc = 12mhz: pclk = cclk
> >
> > feed();
> >
> > PLLCON=0x1; // Enabling the PLL
> > feed();
> >
> > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set frequency
> >
> > PLLCON=0x3;/ / Connect the PLL as the clock source
> > feed();
> >
> > }
> > //********** ********* ********* ********* ********* *********
> ********* ***
> > void setuart(int speed) //sets up UART0
> > {
> >
> >
> > if(speed==fast)
> > {
> > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > U0DLM = 0x00; //msb = 0
> > U0DLL = 0x20; //lsb = 32
> > U0FCR = 0x07; // enable and reset
> > U0LCR = 0x03; // 8 bit character length
> > VICIntEnClr = 0x00000040;
> > U0IER = 0x00;
> > }
> > else //initialize uart0 115200 buad 12mhz
> > {
> > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > U0DLM = 0x00; //msb = 0
> > U0DLL = 0x6; //lsb = 6
> > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 & mulval(7:4) = 12
> > U0FCR = 0x07; // enable and reset
> > U0LCR = 0x03;
> > VICIntEnClr = 0x00000040;
> > U0IER = 0x00;
> > }
> >
> > }
> >

--
Sutton Mehaffey
Lookout Portable Security
4040 Royal Dr.
Kennesaw, GA 30144
770-514-7999, 800-207-6269
Fax: 770-514-1285
http://www.lookoutportablesecurity.com
s...@lookoutportablesecurity.com

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 8 19:12:22 2010

Thanks for the reply. I am running at 12mhz, and the I have a blinking light that confirms that this is the case, along with a decrease in power draw. I am setting the multiplier(M) to 1. I thought that you had to specify the M and P values as well as select the external oscillator. Could this be screwing things up? How does one avoid using the PLL? on waking up from sleep mode, do you bother setting anything, or should you actively disable the PLL by setting PLLC and PLLE to 0? I assume that Pclk would then = cclk.

Thanks again for the advice

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> What's your Fosc? If it is 12, I don't think you need to activate PLL0,
> if that's your CCLK speed.
>
> ssonderhoff wrote:
> >
> >
> > Perhaps I should re-state the question. The PLLCFG and UART) settings
> > seem to be correct - Please let me know if you can see some mistake - Is
> > there anything else that could affect UART0 after a cclk change. The
> > port is active, but the output is garbage. Any thoughts would be welcome.
> >
> > --- In lpc2000@yahoogroups .com ,
> > "ssonderhoff" wrote:
> > >
> > > I am running the lpc2148 at a low clock speed of 12 mhz to reduce
> > power usage. This is working, the power consumption is down and a light
> > blinks at the correct rate. for each speed I reset the Uart0 parameters
> > to take the pclk into account (code below)
> > >
> > > the PLL_int(code below) sets processor to 12mhz(slow).
> > >
> > > At 60mhz Everything is working fine fine and I can read the output
> > debug text without any problem.
> > >
> > > At 12 mhz it outputs nothing but garbage, I have tried setting to
> > different baud rates from low to high with the same result.
> > >
> > > The Uart settings were determined using the NXP lpc2000 calculator
> > >
> > > I believe that I have faithfully followed the data sheet. Can anyone
> > tell me what I am missing?
> > > Thanks,
> > > Stefan
> > >
> > > //*********CODE* ********* *
> > > void PLL_init(int speed) // sets clock speed
> > > {
> > >
> > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> > Divider(8) 1xosc = 12mhz: pclk = cclk
> > >
> > > feed();
> > >
> > > PLLCON=0x1; // Enabling the PLL
> > > feed();
> > >
> > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set frequency
> > >
> > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > feed();
> > >
> > > }
> > > //********** ********* ********* ********* ********* *********
> > ********* ***
> > > void setuart(int speed) //sets up UART0
> > > {
> > >
> > >
> > > if(speed==fast)
> > > {
> > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > U0DLM = 0x00; //msb = 0
> > > U0DLL = 0x20; //lsb = 32
> > > U0FCR = 0x07; // enable and reset
> > > U0LCR = 0x03; // 8 bit character length
> > > VICIntEnClr = 0x00000040;
> > > U0IER = 0x00;
> > > }
> > > else //initialize uart0 115200 buad 12mhz
> > > {
> > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > U0DLM = 0x00; //msb = 0
> > > U0DLL = 0x6; //lsb = 6
> > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 & mulval(7:4) = 12
> > > U0FCR = 0x07; // enable and reset
> > > U0LCR = 0x03;
> > > VICIntEnClr = 0x00000040;
> > > U0IER = 0x00;
> > > }
> > >
> > > }
> > >
> >
> > --
> Sutton Mehaffey
> Lookout Portable Security
> 4040 Royal Dr.
> Kennesaw, GA 30144
> 770-514-7999, 800-207-6269
> Fax: 770-514-1285
> http://www.lookoutportablesecurity.com
> sutton@...
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - mant...@compusmart.ab.ca - Feb 8 19:14:30 2010

Quoting ssonderhoff :

> Thanks for the reply. I am running at 12mhz, and the I have a
> blinking light that confirms that this is the case, along with a
> decrease in power draw. I am setting the multiplier(M) to 1. I
> thought that you had to specify the M and P values as well as select
> the external oscillator. Could this be screwing things up? How does
> one avoid using the PLL? on waking up from sleep mode, do you bother
> setting anything, or should you actively disable the PLL by setting
> PLLC and PLLE to 0? I assume that Pclk would then = cclk.
>
> Thanks again for the advice

If I remember correctly, the PLL is disabled when waking up from sleep
mode. If you need the PLL you need to reinitialize it again.

Mike
>
> --- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>>
>> What's your Fosc? If it is 12, I don't think you need to activate PLL0,
>> if that's your CCLK speed.
>>
>> ssonderhoff wrote:
>> >
>> >
>> > Perhaps I should re-state the question. The PLLCFG and UART) settings
>> > seem to be correct - Please let me know if you can see some mistake - Is
>> > there anything else that could affect UART0 after a cclk change. The
>> > port is active, but the output is garbage. Any thoughts would be welcome.
>> >
>> > --- In lpc2000@yahoogroups .com ,
>> > "ssonderhoff" wrote:
>> > >
>> > > I am running the lpc2148 at a low clock speed of 12 mhz to reduce
>> > power usage. This is working, the power consumption is down and a light
>> > blinks at the correct rate. for each speed I reset the Uart0 parameters
>> > to take the pclk into account (code below)
>> > >
>> > > the PLL_int(code below) sets processor to 12mhz(slow).
>> > >
>> > > At 60mhz Everything is working fine fine and I can read the output
>> > debug text without any problem.
>> > >
>> > > At 12 mhz it outputs nothing but garbage, I have tried setting to
>> > different baud rates from low to high with the same result.
>> > >
>> > > The Uart settings were determined using the NXP lpc2000 calculator
>> > >
>> > > I believe that I have faithfully followed the data sheet. Can anyone
>> > tell me what I am missing?
>> > > Thanks,
>> > > Stefan
>> > >
>> > > //*********CODE* ********* *
>> > > void PLL_init(int speed) // sets clock speed
>> > > {
>> > >
>> > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
>> > Divider(4) so 5xosc (12mhz) = 60 mhz
>> > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
>> > Divider(8) 1xosc = 12mhz: pclk = cclk
>> > >
>> > > feed();
>> > >
>> > > PLLCON=0x1; // Enabling the PLL
>> > > feed();
>> > >
>> > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set frequency
>> > >
>> > > PLLCON=0x3;/ / Connect the PLL as the clock source
>> > > feed();
>> > >
>> > > }
>> > > //********** ********* ********* ********* ********* *********
>> > ********* ***
>> > > void setuart(int speed) //sets up UART0
>> > > {
>> > >
>> > >
>> > > if(speed==fast)
>> > > {
>> > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
>> > > U0DLM = 0x00; //msb = 0
>> > > U0DLL = 0x20; //lsb = 32
>> > > U0FCR = 0x07; // enable and reset
>> > > U0LCR = 0x03; // 8 bit character length
>> > > VICIntEnClr = 0x00000040;
>> > > U0IER = 0x00;
>> > > }
>> > > else //initialize uart0 115200 buad 12mhz
>> > > {
>> > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
>> > > U0DLM = 0x00; //msb = 0
>> > > U0DLL = 0x6; //lsb = 6
>> > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 & mulval(7:4) = 12
>> > > U0FCR = 0x07; // enable and reset
>> > > U0LCR = 0x03;
>> > > VICIntEnClr = 0x00000040;
>> > > U0IER = 0x00;
>> > > }
>> > >
>> > > }
>> > >
>> >
>> >
>>
>> --
>> Sutton Mehaffey
>> Lookout Portable Security
>> 4040 Royal Dr.
>> Kennesaw, GA 30144
>> 770-514-7999, 800-207-6269
>> Fax: 770-514-1285
>> http://www.lookoutportablesecurity.com
>> sutton@...
>>
> ------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Sutton Mehaffey - Feb 8 19:41:13 2010

I don't turn PLL on when I use PCLK=CCLK. Mine works fine. Try it and
see if it fixes your problem. I think you only need PLL on if you need
more speed than PCLK.

ssonderhoff wrote:
>
> Thanks for the reply. I am running at 12mhz, and the I have a blinking
> light that confirms that this is the case, along with a decrease in
> power draw. I am setting the multiplier(M) to 1. I thought that you
> had to specify the M and P values as well as select the external
> oscillator. Could this be screwing things up? How does one avoid using
> the PLL? on waking up from sleep mode, do you bother setting anything,
> or should you actively disable the PLL by setting PLLC and PLLE to 0?
> I assume that Pclk would then = cclk.
>
> Thanks again for the advice
> --- In l...@yahoogroups.com ,
> Sutton Mehaffey wrote:
> >
> > What's your Fosc? If it is 12, I don't think you need to activate PLL0,
> > if that's your CCLK speed.
> >
> >
> >
> > ssonderhoff wrote:
> > >
> > >
> > > Perhaps I should re-state the question. The PLLCFG and UART) settings
> > > seem to be correct - Please let me know if you can see some
> mistake - Is
> > > there anything else that could affect UART0 after a cclk change. The
> > > port is active, but the output is garbage. Any thoughts would be
> welcome.
> > >
> > > --- In lpc2000@yahoogroups .com ,
> > > "ssonderhoff" wrote:
> > > >
> > > > I am running the lpc2148 at a low clock speed of 12 mhz to reduce
> > > power usage. This is working, the power consumption is down and a
> light
> > > blinks at the correct rate. for each speed I reset the Uart0
> parameters
> > > to take the pclk into account (code below)
> > > >
> > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > >
> > > > At 60mhz Everything is working fine fine and I can read the output
> > > debug text without any problem.
> > > >
> > > > At 12 mhz it outputs nothing but garbage, I have tried setting to
> > > different baud rates from low to high with the same result.
> > > >
> > > > The Uart settings were determined using the NXP lpc2000 calculator
> > > >
> > > > I believe that I have faithfully followed the data sheet. Can
> anyone
> > > tell me what I am missing?
> > > > Thanks,
> > > > Stefan
> > > >
> > > > //*********CODE* ********* *
> > > > void PLL_init(int speed) // sets clock speed
> > > > {
> > > >
> > > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > >
> > > > feed();
> > > >
> > > > PLLCON=0x1; // Enabling the PLL
> > > > feed();
> > > >
> > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> frequency
> > > >
> > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > feed();
> > > >
> > > > }
> > > > //********** ********* ********* ********* ********* *********
> > > ********* ***
> > > > void setuart(int speed) //sets up UART0
> > > > {
> > > >
> > > >
> > > > if(speed==fast)
> > > > {
> > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > U0DLM = 0x00; //msb = 0
> > > > U0DLL = 0x20; //lsb = 32
> > > > U0FCR = 0x07; // enable and reset
> > > > U0LCR = 0x03; // 8 bit character length
> > > > VICIntEnClr = 0x00000040;
> > > > U0IER = 0x00;
> > > > }
> > > > else //initialize uart0 115200 buad 12mhz
> > > > {
> > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > U0DLM = 0x00; //msb = 0
> > > > U0DLL = 0x6; //lsb = 6
> > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 & mulval(7:4) = 12
> > > > U0FCR = 0x07; // enable and reset
> > > > U0LCR = 0x03;
> > > > VICIntEnClr = 0x00000040;
> > > > U0IER = 0x00;
> > > > }
> > > >
> > > > }
> > > >
> > >
> > >
> >
> > --
> > Sutton Mehaffey
> > Lookout Portable Security
> > 4040 Royal Dr.
> > Kennesaw, GA 30144
> > 770-514-7999, 800-207-6269
> > Fax: 770-514-1285
> > http://www.lookoutportablesecurity.com
>
> > sutton@...
> >

--
Sutton Mehaffey
Lookout Portable Security
4040 Royal Dr. #100
Kennesaw, GA 30144
800-207-6269, 770-514-7999, 770-514-1285 FAX
s...@lookoutportablesecurity.com

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 8 22:30:25 2010

I removed the setting the PLL - after wake up I do not set PLL -=20
same problem - UART0 outputs garbage (see sample)

0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.

the light on the serial connection is blinking and the junk is being output=
at a regular interval. these are the settings used to set the baud rate to=
9600 - They seem correct to me

U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1=20
U0DLM =3D 0x00; //msb =3D 0
U0DLL =3D 0x4E; //lsb =3D 78
U0FCR =3D 0x07; // enable and reset
U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;=20=09
//VICIntEnClr =3D 0x00000040;
U0IER =3D 0x00;

I am at a loss and would appreciate any help
Stefan

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> I don't turn PLL on when I use PCLK=3DCCLK. Mine works fine. Try it and=20
> see if it fixes your problem. I think you only need PLL on if you need=20
> more speed than PCLK.
>=20
> ssonderhoff wrote:
> >
> > Thanks for the reply. I am running at 12mhz, and the I have a blinking=
=20
> > light that confirms that this is the case, along with a decrease in=20
> > power draw. I am setting the multiplier(M) to 1. I thought that you=20
> > had to specify the M and P values as well as select the external=20
> > oscillator. Could this be screwing things up? How does one avoid using=
=20
> > the PLL? on waking up from sleep mode, do you bother setting anything,=
=20
> > or should you actively disable the PLL by setting PLLC and PLLE to 0?=20
> > I assume that Pclk would then =3D cclk.
> >
> > Thanks again for the advice
> >
> >
> > --- In l...@yahoogroups.com ,=20
> > Sutton Mehaffey wrote:
> > >
> > > What's your Fosc? If it is 12, I don't think you need to activate PLL=
0,
> > > if that's your CCLK speed.
> > >
> > >
> > >
> > > ssonderhoff wrote:
> > > >
> > > >
> > > > Perhaps I should re-state the question. The PLLCFG and UART) settin=
gs
> > > > seem to be correct - Please let me know if you can see some=20
> > mistake - Is
> > > > there anything else that could affect UART0 after a cclk change. Th=
e
> > > > port is active, but the output is garbage. Any thoughts would be=20
> > welcome.
> > > >
> > > > --- In lpc2000@yahoogroups .com ,
> > > > "ssonderhoff" wrote:
> > > > >
> > > > > I am running the lpc2148 at a low clock speed of 12 mhz to reduce
> > > > power usage. This is working, the power consumption is down and a=20
> > light
> > > > blinks at the correct rate. for each speed I reset the Uart0=20
> > parameters
> > > > to take the pclk into account (code below)
> > > > >
> > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > >
> > > > > At 60mhz Everything is working fine fine and I can read the outpu=
t
> > > > debug text without any problem.
> > > > >
> > > > > At 12 mhz it outputs nothing but garbage, I have tried setting to
> > > > different baud rates from low to high with the same result.
> > > > >
> > > > > The Uart settings were determined using the NXP lpc2000 calculato=
r
> > > > >
> > > > > I believe that I have faithfully followed the data sheet. Can=20
> > anyone
> > > > tell me what I am missing?
> > > > > Thanks,
> > > > > Stefan
> > > > >
> > > > > //*********CODE* ********* *
> > > > > void PLL_init(int speed) // sets clock speed
> > > > > {
> > > > >
> > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting Multiplier(5) an=
d
> > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting Multiplier(1) and
> > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > >
> > > > > feed();
> > > > >
> > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > feed();
> > > > >
> > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set=20
> > frequency
> > > > >
> > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock source
> > > > > feed();
> > > > >
> > > > > }
> > > > > //********** ********* ********* ********* ********* *********
> > > > ********* ***
> > > > > void setuart(int speed) //sets up UART0
> > > > > {
> > > > >
> > > > >
> > > > > if(speed=3D=3Dfast)
> > > > > {
> > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > U0FCR =3D 0x07; // enable and reset
> > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > VICIntEnClr =3D 0x00000040;
> > > > > U0IER =3D 0x00;
> > > > > }
> > > > > else //initialize uart0 115200 buad 12mhz
> > > > > {
> > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =3D 1 & mulval(7:=
4) =3D 12
> > > > > U0FCR =3D 0x07; // enable and reset
> > > > > U0LCR =3D 0x03;
> > > > > VICIntEnClr =3D 0x00000040;
> > > > > U0IER =3D 0x00;
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > >
> > > >
> > >
> > > --
> > > Sutton Mehaffey
> > > Lookout Portable Security
> > > 4040 Royal Dr.
> > > Kennesaw, GA 30144
> > > 770-514-7999, 800-207-6269
> > > Fax: 770-514-1285
> > > http://www.lookoutportablesecurity.com=20
> >
> > > sutton@
> > >
> >
> >=20
>=20
> --=20
> Sutton Mehaffey
> Lookout Portable Security
> 4040 Royal Dr. #100
> Kennesaw, GA 30144
> 800-207-6269, 770-514-7999, 770-514-1285 FAX
> sutton@...
>

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Sutton Mehaffey - Feb 8 22:36:07 2010

Show your updated PLL code, so I can review it in its entirety, when I
get a chance.
ssonderhoff wrote:
>
> I removed the setting the PLL - after wake up I do not set PLL -
> same problem - UART0 outputs garbage (see sample)
>
> 0£7*6@î0£7*6@®0£w*4@®0£w*4.
>
> the light on the serial connection is blinking and the junk is being
> output at a regular interval. these are the settings used to set the
> baud rate to 9600 - They seem correct to me
>
> U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> U0DLM = 0x00; //msb = 0
> U0DLL = 0x4E; //lsb = 78
> U0FCR = 0x07; // enable and reset
> U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> //VICIntEnClr = 0x00000040;
> U0IER = 0x00;
>
> I am at a loss and would appreciate any help
> Stefan
>
> --- In l...@yahoogroups.com ,
> Sutton Mehaffey wrote:
> >
> > I don't turn PLL on when I use PCLK=CCLK. Mine works fine. Try it and
> > see if it fixes your problem. I think you only need PLL on if you need
> > more speed than PCLK.
> >
> > ssonderhoff wrote:
> > >
> > > Thanks for the reply. I am running at 12mhz, and the I have a
> blinking
> > > light that confirms that this is the case, along with a decrease in
> > > power draw. I am setting the multiplier(M) to 1. I thought that you
> > > had to specify the M and P values as well as select the external
> > > oscillator. Could this be screwing things up? How does one avoid
> using
> > > the PLL? on waking up from sleep mode, do you bother setting
> anything,
> > > or should you actively disable the PLL by setting PLLC and PLLE to 0?
> > > I assume that Pclk would then = cclk.
> > >
> > > Thanks again for the advice
> > >
> > >
> > > --- In l...@yahoogroups.com
> ,
> > > Sutton Mehaffey wrote:
> > > >
> > > > What's your Fosc? If it is 12, I don't think you need to
> activate PLL0,
> > > > if that's your CCLK speed.
> > > >
> > > >
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > >
> > > > > Perhaps I should re-state the question. The PLLCFG and UART)
> settings
> > > > > seem to be correct - Please let me know if you can see some
> > > mistake - Is
> > > > > there anything else that could affect UART0 after a cclk
> change. The
> > > > > port is active, but the output is garbage. Any thoughts would be
> > > welcome.
> > > > >
> > > > > --- In lpc2000@yahoogroups .com
> ,
> > > > > "ssonderhoff" wrote:
> > > > > >
> > > > > > I am running the lpc2148 at a low clock speed of 12 mhz to
> reduce
> > > > > power usage. This is working, the power consumption is down and a
> > > light
> > > > > blinks at the correct rate. for each speed I reset the Uart0
> > > parameters
> > > > > to take the pclk into account (code below)
> > > > > >
> > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > >
> > > > > > At 60mhz Everything is working fine fine and I can read the
> output
> > > > > debug text without any problem.
> > > > > >
> > > > > > At 12 mhz it outputs nothing but garbage, I have tried
> setting to
> > > > > different baud rates from low to high with the same result.
> > > > > >
> > > > > > The Uart settings were determined using the NXP lpc2000
> calculator
> > > > > >
> > > > > > I believe that I have faithfully followed the data sheet. Can
> > > anyone
> > > > > tell me what I am missing?
> > > > > > Thanks,
> > > > > > Stefan
> > > > > >
> > > > > > //*********CODE* ********* *
> > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > {
> > > > > >
> > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > >
> > > > > > feed();
> > > > > >
> > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > feed();
> > > > > >
> > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > frequency
> > > > > >
> > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > feed();
> > > > > >
> > > > > > }
> > > > > > //********** ********* ********* ********* ********* *********
> > > > > ********* ***
> > > > > > void setuart(int speed) //sets up UART0
> > > > > > {
> > > > > >
> > > > > >
> > > > > > if(speed==fast)
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
> mulval(7:4) = 12
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03;
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > >
> > > > >
> > > >
> > > > --
> > > > Sutton Mehaffey
> > > > Lookout Portable Security
> > > > 4040 Royal Dr.
> > > > Kennesaw, GA 30144
> > > > 770-514-7999, 800-207-6269
> > > > Fax: 770-514-1285
> > > > http://www.lookoutportablesecurity.com
>
> > > > >
> > > > sutton@
> > > >
> > >
> > >
> >
> > --
> > Sutton Mehaffey
> > Lookout Portable Security
> > 4040 Royal Dr. #100
> > Kennesaw, GA 30144
> > 800-207-6269, 770-514-7999, 770-514-1285 FAX
> > sutton@...
> >

--
Sutton Mehaffey
Lookout Portable Security
4040 Royal Dr. #100
Kennesaw, GA 30144
800-207-6269, 770-514-7999, 770-514-1285 FAX
s...@lookoutportablesecurity.com

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 8 22:48:15 2010

I will be appreciative for any insights, this is starting to get quite
frustrating.

This is the code used to set the PLL to 60mhz. I modified it to not set
the PLL in slow mode (12mhz) on wake up and then eliminated going to
this code all together. all gave the same result. As i mentioned
earlier, everything works fine at 60mhz, where as at 12 mhz it has not
worked with or without setting PLL. UART settings are in the previous
message

Thanks again,
Stefan

void PLL_init(int speed)
{

if(speed==fast){PLLCFG=0x24;} // Setting Multiplier(5) and
Divider(4) so 5xosc (12mhz) = 60 mhz
else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60

feed();

PLLCON=0x1; // Enabling the PLL
feed();

while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
frequency

PLLCON=0x3;// Connect the PLL as the clock source
feed();
}
--- In l...@yahoogroups.com, "ssonderhoff" wrote:
>
> I removed the setting the PLL - after wake up I do not set PLL -
> same problem - UART0 outputs garbage (see sample)
>
> 0£7*6@î0£7*6@®0£w*4@®0£w*4.
>
> the light on the serial connection is blinking and the junk is being
output at a regular interval. these are the settings used to set the
baud rate to 9600 - They seem correct to me
>
> U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> U0DLM = 0x00; //msb = 0
> U0DLL = 0x4E; //lsb = 78
> U0FCR = 0x07; // enable and reset
> U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> //VICIntEnClr = 0x00000040;
> U0IER = 0x00;
>
> I am at a loss and would appreciate any help
> Stefan
>
> --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> >
> > I don't turn PLL on when I use PCLK=CCLK. Mine works fine. Try it
and
> > see if it fixes your problem. I think you only need PLL on if you
need
> > more speed than PCLK.
> >
> > ssonderhoff wrote:
> > >
> > > Thanks for the reply. I am running at 12mhz, and the I have a
blinking
> > > light that confirms that this is the case, along with a decrease
in
> > > power draw. I am setting the multiplier(M) to 1. I thought that
you
> > > had to specify the M and P values as well as select the external
> > > oscillator. Could this be screwing things up? How does one avoid
using
> > > the PLL? on waking up from sleep mode, do you bother setting
anything,
> > > or should you actively disable the PLL by setting PLLC and PLLE to
0?
> > > I assume that Pclk would then = cclk.
> > >
> > > Thanks again for the advice
> > >
> > >
> > > --- In l...@yahoogroups.com ,
> > > Sutton Mehaffey wrote:
> > > >
> > > > What's your Fosc? If it is 12, I don't think you need to
activate PLL0,
> > > > if that's your CCLK speed.
> > > >
> > > >
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > >
> > > > > Perhaps I should re-state the question. The PLLCFG and UART)
settings
> > > > > seem to be correct - Please let me know if you can see some
> > > mistake - Is
> > > > > there anything else that could affect UART0 after a cclk
change. The
> > > > > port is active, but the output is garbage. Any thoughts would
be
> > > welcome.
> > > > >
> > > > > --- In lpc2000@yahoogroups .com
,
> > > > > "ssonderhoff" wrote:
> > > > > >
> > > > > > I am running the lpc2148 at a low clock speed of 12 mhz to
reduce
> > > > > power usage. This is working, the power consumption is down
and a
> > > light
> > > > > blinks at the correct rate. for each speed I reset the Uart0
> > > parameters
> > > > > to take the pclk into account (code below)
> > > > > >
> > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > >
> > > > > > At 60mhz Everything is working fine fine and I can read the
output
> > > > > debug text without any problem.
> > > > > >
> > > > > > At 12 mhz it outputs nothing but garbage, I have tried
setting to
> > > > > different baud rates from low to high with the same result.
> > > > > >
> > > > > > The Uart settings were determined using the NXP lpc2000
calculator
> > > > > >
> > > > > > I believe that I have faithfully followed the data sheet.
Can
> > > anyone
> > > > > tell me what I am missing?
> > > > > > Thanks,
> > > > > > Stefan
> > > > > >
> > > > > > //*********CODE* ********* *
> > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > {
> > > > > >
> > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > >
> > > > > > feed();
> > > > > >
> > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > feed();
> > > > > >
> > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to
set
> > > frequency
> > > > > >
> > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > feed();
> > > > > >
> > > > > > }
> > > > > > //********** ********* ********* ********* *********
*********
> > > > > ********* ***
> > > > > > void setuart(int speed) //sets up UART0
> > > > > > {
> > > > > >
> > > > > >
> > > > > > if(speed==fast)
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
mulval(7:4) = 12
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03;
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > >
> > > > >
> > > >
> > > > --
> > > > Sutton Mehaffey
> > > > Lookout Portable Security
> > > > 4040 Royal Dr.
> > > > Kennesaw, GA 30144
> > > > 770-514-7999, 800-207-6269
> > > > Fax: 770-514-1285
> > > > http://www.lookoutportablesecurity.com
> > >
> > > > sutton@
> > > >
> > >
> > >
> >
> > --
> > Sutton Mehaffey
> > Lookout Portable Security
> > 4040 Royal Dr. #100
> > Kennesaw, GA 30144
> > 800-207-6269, 770-514-7999, 770-514-1285 FAX
> > sutton@
>



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

RE: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Michael Anton - Feb 9 0:03:14 2010

Perhaps you could post the balance of your UART code. The initialization
looks fine to me.

Have you tried using only 12MHz, and not going into 60MHz? Just to see if
it is the changing
between the clock speeds that has something to do with the behaviour you are
seeing.

Mike

-----Original Message-----
From: l...@yahoogroups.com [mailto:l...@yahoogroups.com]On Behalf Of
ssonderhoff
Sent: Monday, February 08, 2010 8:46 PM
To: l...@yahoogroups.com
Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk - not working -
Any Advice would be app.

I will be appreciative for any insights, this is starting to get quite
frustrating.

This is the code used to set the PLL to 60mhz. I modified it to not set
the PLL in slow mode (12mhz) on wake up and then eliminated going to this
code all together. all gave the same result. As i mentioned earlier,
everything works fine at 60mhz, where as at 12 mhz it has not worked with or
without setting PLL. UART settings are in the previous message

Thanks again,
Stefan

void PLL_init(int speed)
{

if(speed==fast){PLLCFG=0x24;} // Setting Multiplier(5) and Divider(4)
so 5xosc (12mhz) = 60 mhz
else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60

feed();

PLLCON=0x1; // Enabling the PLL
feed();

while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
frequency

PLLCON=0x3;// Connect the PLL as the clock source
feed();
}
--- In l...@yahoogroups.com, "ssonderhoff" wrote:
>
> I removed the setting the PLL - after wake up I do not set PLL -
> same problem - UART0 outputs garbage (see sample)
>
> 0£7*6@î0£7*6@®0£w*4@®0£w*4.
>
> the light on the serial connection is blinking and the junk is being
output at a regular interval. these are the settings used to set the baud
rate to 9600 - They seem correct to me
>
> U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> U0DLM = 0x00; //msb = 0
> U0DLL = 0x4E; //lsb = 78
> U0FCR = 0x07; // enable and reset
> U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> //VICIntEnClr = 0x00000040;
> U0IER = 0x00;
>
> I am at a loss and would appreciate any help
> Stefan
>
>
>
> --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> >
> > I don't turn PLL on when I use PCLK=CCLK. Mine works fine. Try it and
> > see if it fixes your problem. I think you only need PLL on if you need
> > more speed than PCLK.
> >
> > ssonderhoff wrote:
> > >
> > > Thanks for the reply. I am running at 12mhz, and the I have a
blinking
> > > light that confirms that this is the case, along with a decrease in
> > > power draw. I am setting the multiplier(M) to 1. I thought that you
> > > had to specify the M and P values as well as select the external
> > > oscillator. Could this be screwing things up? How does one avoid
using
> > > the PLL? on waking up from sleep mode, do you bother setting
anything,
> > > or should you actively disable the PLL by setting PLLC and PLLE to
0?
> > > I assume that Pclk would then = cclk.
> > >
> > > Thanks again for the advice
> > >
> > >
> > > --- In l...@yahoogroups.com ,
> > > Sutton Mehaffey wrote:
> > > >
> > > > What's your Fosc? If it is 12, I don't think you need to activate
PLL0,
> > > > if that's your CCLK speed.
> > > >
> > > >
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > >
> > > > > Perhaps I should re-state the question. The PLLCFG and UART)
settings
> > > > > seem to be correct - Please let me know if you can see some
> > > mistake - Is
> > > > > there anything else that could affect UART0 after a cclk change.
The
> > > > > port is active, but the output is garbage. Any thoughts would be
> > > welcome.
> > > > >
> > > > > --- In lpc2000@yahoogroups .com
,
> > > > > "ssonderhoff" wrote:
> > > > > >
> > > > > > I am running the lpc2148 at a low clock speed of 12 mhz to
reduce
> > > > > power usage. This is working, the power consumption is down and
a
> > > light
> > > > > blinks at the correct rate. for each speed I reset the Uart0
> > > parameters
> > > > > to take the pclk into account (code below)
> > > > > >
> > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > >
> > > > > > At 60mhz Everything is working fine fine and I can read the
output
> > > > > debug text without any problem.
> > > > > >
> > > > > > At 12 mhz it outputs nothing but garbage, I have tried setting
to
> > > > > different baud rates from low to high with the same result.
> > > > > >
> > > > > > The Uart settings were determined using the NXP lpc2000
calculator
> > > > > >
> > > > > > I believe that I have faithfully followed the data sheet. Can
> > > anyone
> > > > > tell me what I am missing?
> > > > > > Thanks,
> > > > > > Stefan
> > > > > >
> > > > > > //*********CODE* ********* *
> > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > {
> > > > > >
> > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting Multiplier(5) and
> > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting Multiplier(1) and
> > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > >
> > > > > > feed();
> > > > > >
> > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > feed();
> > > > > >
> > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > frequency
> > > > > >
> > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > feed();
> > > > > >
> > > > > > }
> > > > > > //********** ********* ********* ********* ********* *********
> > > > > ********* ***
> > > > > > void setuart(int speed) //sets up UART0
> > > > > > {
> > > > > >
> > > > > >
> > > > > > if(speed==fast)
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > {
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
mulval(7:4) = 12
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR = 0x03;
> > > > > > VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > >
> > > > >
> > > >
> > > > --
> > > > Sutton Mehaffey



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 9 0:58:00 2010


Hi,
The system boots up using a boot loader that allows the unit to act as a th=
umb drive and access an SD card as well as load firmware updates from the s=
d card. This code initializes the system and sets the initial PLL and is di=
fficult and dangerous for me to change. the code used to set PLL in the boo=
tloader's Boot_up and system_init routines are shown below shown below:
void boot_up(void)
{
//Initialize the MCU clock PLL
system_init();

IODIR0 |=3D (1 << 31);
IOCLR0 |=3D (1 << 31); //Turn on USB LED

//Init UART0 for debug
PINSEL0 |=3D 0x00000005; //enable uart0
U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1=20
U0DLM =3D 0x00;=20
U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock=20=20
U0LCR =3D 0x03; // DLAB =3D 0 =
=20

//Init rprintf
rprintf_devopen(putc_serial0);=20
rprintf("\n\n\nUSB Bootloader v1.1\n");

//IOSET0 |=3D (1 << 31); //Turn off USB LED
}

/**********************************************************
Initialize
**********************************************************/

#define PLOCK 0x400

void system_init(void)
{
// Setting Multiplier and Divider values
PLLCFG=3D0x24;
feed();

// Enabling the PLL */
PLLCON=3D0x1;
feed();

// Wait for the PLL to lock to set frequency
while(!(PLLSTAT & PLOCK)) ;

// Connect the PLL as the clock source
PLLCON=3D0x3;
feed();

// Enabling MAM and setting number of clocks used for Flash memory fetc=
h (4 cclks in this case)
//MAMTIM=3D0x3; //VCOM?
MAMCR=3D0x2;
MAMTIM=3D0x4; //Original

// Setting peripheral Clock (pclk) to System Clock (cclk)
VPBDIV=3D0x1;
}
--- In l...@yahoogroups.com, "Michael Anton" wrote:
>
> Perhaps you could post the balance of your UART code. The initialization
> looks fine to me.
>=20
> Have you tried using only 12MHz, and not going into 60MHz? Just to see i=
f
> it is the changing
> between the clock speeds that has something to do with the behaviour you =
are
> seeing.
>=20
> Mike
>=20
> -----Original Message-----
> From: l...@yahoogroups.com [mailto:l...@yahoogroups.com]On Behalf=
Of
> ssonderhoff
> Sent: Monday, February 08, 2010 8:46 PM
> To: l...@yahoogroups.com
> Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk - not workin=
g -
> Any Advice would be app.
>=20
>=20
>=20
>=20
> I will be appreciative for any insights, this is starting to get quite
> frustrating.
>=20
> This is the code used to set the PLL to 60mhz. I modified it to not set
> the PLL in slow mode (12mhz) on wake up and then eliminated going to this
> code all together. all gave the same result. As i mentioned earlier,
> everything works fine at 60mhz, where as at 12 mhz it has not worked with=
or
> without setting PLL. UART settings are in the previous message
>=20
> Thanks again,
> Stefan
>=20
> void PLL_init(int speed)
> {
>=20
> if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting Multiplier(5) and D=
ivider(4)
> so 5xosc (12mhz) =3D 60 mhz
> else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x60
>=20
> feed();
>=20
> PLLCON=3D0x1; // Enabling the PLL
> feed();
>=20
> while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> frequency
>=20
> PLLCON=3D0x3;// Connect the PLL as the clock source
> feed();
> }
> --- In l...@yahoogroups.com, "ssonderhoff" wrote:
> >
> > I removed the setting the PLL - after wake up I do not set PLL -
> > same problem - UART0 outputs garbage (see sample)
> >
> > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.
> >
> > the light on the serial connection is blinking and the junk is being
> output at a regular interval. these are the settings used to set the baud
> rate to 9600 - They seem correct to me
> >
> > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > U0DLM =3D 0x00; //msb =3D 0
> > U0DLL =3D 0x4E; //lsb =3D 78
> > U0FCR =3D 0x07; // enable and reset
> > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > //VICIntEnClr =3D 0x00000040;
> > U0IER =3D 0x00;
> >
> > I am at a loss and would appreciate any help
> > Stefan
> >
> >
> >
> > --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> > >
> > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works fine. Try it=
and
> > > see if it fixes your problem. I think you only need PLL on if you n=
eed
> > > more speed than PCLK.
> > >
> > > ssonderhoff wrote:
> > > >
> > > > Thanks for the reply. I am running at 12mhz, and the I have a
> blinking
> > > > light that confirms that this is the case, along with a decrease =
in
> > > > power draw. I am setting the multiplier(M) to 1. I thought that y=
ou
> > > > had to specify the M and P values as well as select the external
> > > > oscillator. Could this be screwing things up? How does one avoid
> using
> > > > the PLL? on waking up from sleep mode, do you bother setting
> anything,
> > > > or should you actively disable the PLL by setting PLLC and PLLE t=
o
> 0?
> > > > I assume that Pclk would then =3D cclk.
> > > >
> > > > Thanks again for the advice
> > > >
> > > >
> > > > --- In l...@yahoogroups.com =
,
> > > > Sutton Mehaffey wrote:
> > > > >
> > > > > What's your Fosc? If it is 12, I don't think you need to activa=
te
> PLL0,
> > > > > if that's your CCLK speed.
> > > > >
> > > > >
> > > > >
> > > > > ssonderhoff wrote:
> > > > > >
> > > > > >
> > > > > > Perhaps I should re-state the question. The PLLCFG and UART)
> settings
> > > > > > seem to be correct - Please let me know if you can see some
> > > > mistake - Is
> > > > > > there anything else that could affect UART0 after a cclk chan=
ge.
> The
> > > > > > port is active, but the output is garbage. Any thoughts would=
be
> > > > welcome.
> > > > > >
> > > > > > --- In lpc2000@yahoogroups .com
> ,
> > > > > > "ssonderhoff" wrote:
> > > > > > >
> > > > > > > I am running the lpc2148 at a low clock speed of 12 mhz to
> reduce
> > > > > > power usage. This is working, the power consumption is down a=
nd
> a
> > > > light
> > > > > > blinks at the correct rate. for each speed I reset the Uart0
> > > > parameters
> > > > > > to take the pclk into account (code below)
> > > > > > >
> > > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > > >
> > > > > > > At 60mhz Everything is working fine fine and I can read the
> output
> > > > > > debug text without any problem.
> > > > > > >
> > > > > > > At 12 mhz it outputs nothing but garbage, I have tried sett=
ing
> to
> > > > > > different baud rates from low to high with the same result.
> > > > > > >
> > > > > > > The Uart settings were determined using the NXP lpc2000
> calculator
> > > > > > >
> > > > > > > I believe that I have faithfully followed the data sheet. C=
an
> > > > anyone
> > > > > > tell me what I am missing?
> > > > > > > Thanks,
> > > > > > > Stefan
> > > > > > >
> > > > > > > //*********CODE* ********* *
> > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > {
> > > > > > >
> > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting Multiplier=
(5) and
> > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting Multiplier(1=
) and
> > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > >
> > > > > > > feed();
> > > > > > >
> > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > feed();
> > > > > > >
> > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to s=
et
> > > > frequency
> > > > > > >
> > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock source
> > > > > > > feed();
> > > > > > >
> > > > > > > }
> > > > > > > //********** ********* ********* ********* ********* ******=
***
> > > > > > ********* ***
> > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > {
> > > > > > >
> > > > > > >
> > > > > > > if(speed=3D=3Dfast)
> > > > > > > {
> > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D =
1
> > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > U0IER =3D 0x00;
> > > > > > > }
> > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > {
> > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D =
1
> > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =3D 1 &
> mulval(7:4) =3D 12
> > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > U0LCR =3D 0x03;
> > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > U0IER =3D 0x00;
> > > > > > > }
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > --
> > > > > Sutton Mehaffey
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

RE: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Michael Anton - Feb 9 1:39:56 2010



> -----Original Message-----
> From: l...@yahoogroups.com
> [mailto:l...@yahoogroups.com]On Behalf
> Of ssonderhoff
> Sent: Monday, February 08, 2010 10:54 PM
> To: l...@yahoogroups.com
> Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> not working
> - Any Advice would be app.
>
> Hi,
> The system boots up using a boot loader that allows the unit
> to act as a thumb drive and access an SD card as well as load
> firmware updates from the sd card. This code initializes the
> system and sets the initial PLL and is difficult and
> dangerous for me to change. the code used to set PLL in the
> bootloader's Boot_up and system_init routines are shown below
> shown below:
>

Couldn't you write a piece of standalone test code, without
the bootloader, to test your routines when running at 12MHz?

>
> void boot_up(void)
> {
> //Initialize the MCU clock PLL
> system_init();
>
> IODIR0 |=3D (1 << 31);
> IOCLR0 |=3D (1 << 31); //Turn on USB LED
>
> //Init UART0 for debug
> PINSEL0 |=3D 0x00000005; //enable uart0
> U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1
> U0DLM =3D 0x00;
> U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock

So are you using a 58982400Hz clock, or 60MHz? If this is not
60MHz, you will likely encounter USB problems, as obviously you
cannot reach 48MHz with enough accuracy either.

> U0LCR =3D 0x03; // DLAB =3D 0
>
> //Init rprintf
> rprintf_devopen(putc_serial0);
> rprintf("\n\n\nUSB Bootloader v1.1\n");
>
> //IOSET0 |=3D (1 << 31); //Turn off USB LED
> }
>
> /**********************************************************
> Initialize
> **********************************************************/
>
> #define PLOCK 0x400
>
> void system_init(void)
> {
> // Setting Multiplier and Divider values
> PLLCFG=3D0x24;
> feed();
>
> // Enabling the PLL */
> PLLCON=3D0x1;
> feed();
>
> // Wait for the PLL to lock to set frequency
> while(!(PLLSTAT & PLOCK)) ;
>
> // Connect the PLL as the clock source
> PLLCON=3D0x3;
> feed();
>
> // Enabling MAM and setting number of clocks used for
> Flash memory fetch (4 cclks in this case)
> //MAMTIM=3D0x3; //VCOM?
> MAMCR=3D0x2;
> MAMTIM=3D0x4; //Original

It may not matter, but I usually change the MAM timing values
prior to enabling the PLL. My rational is that if the values
are set wrong when already running at 60MHz, how could I expect
to reliably set them? Since there is no guarantee that I can read
from flash if they are set for a lower clock rate.

>
> // Setting peripheral Clock (pclk) to System Clock (cclk)
> VPBDIV=3D0x1;
> }

Like I said before, your initialization looks fine, but I suspect the
problem you are having might be elsewhere. So it would be useful to
see the rest of your serial port code. Perhaps there is some timing
issue that occurs when you run 5 times slower.

When I developed my UART code, I had all sorts of problems that would
occur at times, with seemingly no explanation, until I figured out
the problem. It was very non-obvious at the time.

So, if you can, break this down into a small piece of code that
demonstrates the problem, I'll take a look at it.

Mike

> --- In l...@yahoogroups.com, "Michael Anton" wrote:
> >
> > Perhaps you could post the balance of your UART code. The
> initialization
> > looks fine to me.
> >
> > Have you tried using only 12MHz, and not going into 60MHz?
> Just to see if
> > it is the changing
> > between the clock speeds that has something to do with the
> behaviour you are
> > seeing.
> >
> > Mike
> >
> > -----Original Message-----
> > From: l...@yahoogroups.com
> [mailto:l...@yahoogroups.com]On Behalf Of
> > ssonderhoff
> > Sent: Monday, February 08, 2010 8:46 PM
> > To: l...@yahoogroups.com
> > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> pclk - not working -
> > Any Advice would be app.
> >
> >
> >
> >
> > I will be appreciative for any insights, this is starting
> to get quite
> > frustrating.
> >
> > This is the code used to set the PLL to 60mhz. I modified
> it to not set
> > the PLL in slow mode (12mhz) on wake up and then eliminated
> going to this
> > code all together. all gave the same result. As i mentioned earlier,
> > everything works fine at 60mhz, where as at 12 mhz it has
> not worked with or
> > without setting PLL. UART settings are in the previous message
> >
> > Thanks again,
> > Stefan
> >
> > void PLL_init(int speed)
> > {
> >
> > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> Multiplier(5) and Divider(4)
> > so 5xosc (12mhz) =3D 60 mhz
> > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x60
> >
> > feed();
> >
> > PLLCON=3D0x1; // Enabling the PLL
> > feed();
> >
> > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > frequency
> >
> > PLLCON=3D0x3;// Connect the PLL as the clock source
> > feed();
> > }
> > --- In l...@yahoogroups.com, "ssonderhoff"
> wrote:
> > >
> > > I removed the setting the PLL - after wake up I do not set PLL -
> > > same problem - UART0 outputs garbage (see sample)
> > >
> > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.
> > >
> > > the light on the serial connection is blinking and the
> junk is being
> > output at a regular interval. these are the settings used
> to set the baud
> > rate to 9600 - They seem correct to me
> > >
> > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > U0DLM =3D 0x00; //msb =3D 0
> > > U0DLL =3D 0x4E; //lsb =3D 78
> > > U0FCR =3D 0x07; // enable and reset
> > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > > //VICIntEnClr =3D 0x00000040;
> > > U0IER =3D 0x00;
> > >
> > > I am at a loss and would appreciate any help
> > > Stefan
> > >
> > >
> > >
> > > --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> > > >
> > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works
> fine. Try it and
> > > > see if it fixes your problem. I think you only need
> PLL on if you need
> > > > more speed than PCLK.
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > > Thanks for the reply. I am running at 12mhz, and
> the I have a
> > blinking
> > > > > light that confirms that this is the case, along
> with a decrease in
> > > > > power draw. I am setting the multiplier(M) to 1. I
> thought that you
> > > > > had to specify the M and P values as well as select
> the external
> > > > > oscillator. Could this be screwing things up? How
> does one avoid
> > using
> > > > > the PLL? on waking up from sleep mode, do you bother setting
> > anything,
> > > > > or should you actively disable the PLL by setting
> PLLC and PLLE to
> > 0?
> > > > > I assume that Pclk would then =3D cclk.
> > > > >
> > > > > Thanks again for the advice
> > > > >
> > > > >
> > > > > --- In l...@yahoogroups.com
> ,
> > > > > Sutton Mehaffey wrote:
> > > > > >
> > > > > > What's your Fosc? If it is 12, I don't think you
> need to activate
> > PLL0,
> > > > > > if that's your CCLK speed.
> > > > > >
> > > > > >
> > > > > >
> > > > > > ssonderhoff wrote:
> > > > > > >
> > > > > > >
> > > > > > > Perhaps I should re-state the question. The
> PLLCFG and UART)
> > settings
> > > > > > > seem to be correct - Please let me know if you
> can see some
> > > > > mistake - Is
> > > > > > > there anything else that could affect UART0
> after a cclk change.
> > The
> > > > > > > port is active, but the output is garbage. Any
> thoughts would be
> > > > > welcome.
> > > > > > >
> > > > > > > --- In lpc2000@yahoogroups .com
> > ,
> > > > > > > "ssonderhoff" wrote:
> > > > > > > >
> > > > > > > > I am running the lpc2148 at a low clock speed
> of 12 mhz to
> > reduce
> > > > > > > power usage. This is working, the power
> consumption is down and
> > a
> > > > > light
> > > > > > > blinks at the correct rate. for each speed I
> reset the Uart0
> > > > > parameters
> > > > > > > to take the pclk into account (code below)
> > > > > > > >
> > > > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > > > >
> > > > > > > > At 60mhz Everything is working fine fine and
> I can read the
> > output
> > > > > > > debug text without any problem.
> > > > > > > >
> > > > > > > > At 12 mhz it outputs nothing but garbage, I
> have tried setting
> > to
> > > > > > > different baud rates from low to high with the
> same result.
> > > > > > > >
> > > > > > > > The Uart settings were determined using the
> NXP lpc2000
> > calculator
> > > > > > > >
> > > > > > > > I believe that I have faithfully followed the
> data sheet. Can
> > > > > anyone
> > > > > > > tell me what I am missing?
> > > > > > > > Thanks,
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > > //*********CODE* ********* *
> > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > {
> > > > > > > >
> > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting
> Multiplier(5) and
> > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting
> Multiplier(1) and
> > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > >
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> PLL to lock to set
> > > > > frequency
> > > > > > > >
> > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock source
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > }
> > > > > > > > //********** ********* ********* *********
> ********* *********
> > > > > > > ********* ***
> > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > {
> > > > > > > >
> > > > > > > >
> > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > {
> > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> bit, DLAB =3D 1
> > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > U0IER =3D 0x00;
> > > > > > > > }
> > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > {
> > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> bit, DLAB =3D 1
> > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =3D 1 &
> > mulval(7:4) =3D 12
> > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > U0LCR =3D 0x03;
> > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > U0IER =3D 0x00;
> > > > > > > > }
> > > > > > > >
> > > > > > > > }
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > Sutton Mehaffey
> >
> ------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - ssonderhoff - Feb 9 1:59:40 2010


The board comes with the bootloader loaded and I have loaded all my firmwar=
e using the bootlader. I would hate to overwrite the bootloader and not be =
able to program the board. my test program puts the computer to sleep and t=
hen on wake up resets PLL or not, sets uart and then goes into a loop and c=
ontsantly prints out a string. At 60mhz everythng works and 12, not so much=
.
Stefan

=20
--- In l...@yahoogroups.com, "Michael Anton" wrote:
>
>=20
>=20
> > -----Original Message-----
> > From: l...@yahoogroups.com
> > [mailto:l...@yahoogroups.com]On Behalf
> > Of ssonderhoff
> > Sent: Monday, February 08, 2010 10:54 PM
> > To: l...@yahoogroups.com
> > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > not working
> > - Any Advice would be app.
> >
> >
> >
> > Hi,
> > The system boots up using a boot loader that allows the unit
> > to act as a thumb drive and access an SD card as well as load
> > firmware updates from the sd card. This code initializes the
> > system and sets the initial PLL and is difficult and
> > dangerous for me to change. the code used to set PLL in the
> > bootloader's Boot_up and system_init routines are shown below
> > shown below:
> >
>=20
> Couldn't you write a piece of standalone test code, without
> the bootloader, to test your routines when running at 12MHz?
>=20
> >
> > void boot_up(void)
> > {
> > //Initialize the MCU clock PLL
> > system_init();
> >
> > IODIR0 |=3D (1 << 31);
> > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> >
> > //Init UART0 for debug
> > PINSEL0 |=3D 0x00000005; //enable uart0
> > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1
> > U0DLM =3D 0x00;
> > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
>=20
> So are you using a 58982400Hz clock, or 60MHz? If this is not
> 60MHz, you will likely encounter USB problems, as obviously you
> cannot reach 48MHz with enough accuracy either.
>=20
> > U0LCR =3D 0x03; // DLAB =3D 0
> >
> > //Init rprintf
> > rprintf_devopen(putc_serial0);
> > rprintf("\n\n\nUSB Bootloader v1.1\n");
> >
> > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > }
> >
> > /**********************************************************
> > Initialize
> > **********************************************************/
> >
> > #define PLOCK 0x400
> >
> > void system_init(void)
> > {
> > // Setting Multiplier and Divider values
> > PLLCFG=3D0x24;
> > feed();
> >
> > // Enabling the PLL */
> > PLLCON=3D0x1;
> > feed();
> >
> > // Wait for the PLL to lock to set frequency
> > while(!(PLLSTAT & PLOCK)) ;
> >
> > // Connect the PLL as the clock source
> > PLLCON=3D0x3;
> > feed();
> >
> > // Enabling MAM and setting number of clocks used for
> > Flash memory fetch (4 cclks in this case)
> > //MAMTIM=3D0x3; //VCOM?
> > MAMCR=3D0x2;
> > MAMTIM=3D0x4; //Original
>=20
> It may not matter, but I usually change the MAM timing values
> prior to enabling the PLL. My rational is that if the values
> are set wrong when already running at 60MHz, how could I expect
> to reliably set them? Since there is no guarantee that I can read
> from flash if they are set for a lower clock rate.
>=20
> >
> > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > VPBDIV=3D0x1;
> > }
> >
> >
>=20
> Like I said before, your initialization looks fine, but I suspect the
> problem you are having might be elsewhere. So it would be useful to
> see the rest of your serial port code. Perhaps there is some timing
> issue that occurs when you run 5 times slower.
>=20
> When I developed my UART code, I had all sorts of problems that would
> occur at times, with seemingly no explanation, until I figured out
> the problem. It was very non-obvious at the time.
>=20
> So, if you can, break this down into a small piece of code that
> demonstrates the problem, I'll take a look at it.
>=20
> Mike
>=20
>=20
>=20
> > --- In l...@yahoogroups.com, "Michael Anton" wrote:
> > >
> > > Perhaps you could post the balance of your UART code. The
> > initialization
> > > looks fine to me.
> > >
> > > Have you tried using only 12MHz, and not going into 60MHz?
> > Just to see if
> > > it is the changing
> > > between the clock speeds that has something to do with the
> > behaviour you are
> > > seeing.
> > >
> > > Mike
> > >
> > > -----Original Message-----
> > > From: l...@yahoogroups.com
> > [mailto:l...@yahoogroups.com]On Behalf Of
> > > ssonderhoff
> > > Sent: Monday, February 08, 2010 8:46 PM
> > > To: l...@yahoogroups.com
> > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > pclk - not working -
> > > Any Advice would be app.
> > >
> > >
> > >
> > >
> > > I will be appreciative for any insights, this is starting
> > to get quite
> > > frustrating.
> > >
> > > This is the code used to set the PLL to 60mhz. I modified
> > it to not set
> > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > going to this
> > > code all together. all gave the same result. As i mentioned earlier,
> > > everything works fine at 60mhz, where as at 12 mhz it has
> > not worked with or
> > > without setting PLL. UART settings are in the previous message
> > >
> > > Thanks again,
> > > Stefan
> > >
> > > void PLL_init(int speed)
> > > {
> > >
> > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > Multiplier(5) and Divider(4)
> > > so 5xosc (12mhz) =3D 60 mhz
> > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x60
> > >
> > > feed();
> > >
> > > PLLCON=3D0x1; // Enabling the PLL
> > > feed();
> > >
> > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > frequency
> > >
> > > PLLCON=3D0x3;// Connect the PLL as the clock source
> > > feed();
> > > }
> > > --- In l...@yahoogroups.com, "ssonderhoff"
> > wrote:
> > > >
> > > > I removed the setting the PLL - after wake up I do not set PLL -
> > > > same problem - UART0 outputs garbage (see sample)
> > > >
> > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.
> > > >
> > > > the light on the serial connection is blinking and the
> > junk is being
> > > output at a regular interval. these are the settings used
> > to set the baud
> > > rate to 9600 - They seem correct to me
> > > >
> > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > > U0DLM =3D 0x00; //msb =3D 0
> > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > U0FCR =3D 0x07; // enable and reset
> > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > > > //VICIntEnClr =3D 0x00000040;
> > > > U0IER =3D 0x00;
> > > >
> > > > I am at a loss and would appreciate any help
> > > > Stefan
> > > >
> > > >
> > > >
> > > > --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> > > > >
> > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works
> > fine. Try it and
> > > > > see if it fixes your problem. I think you only need
> > PLL on if you need
> > > > > more speed than PCLK.
> > > > >
> > > > > ssonderhoff wrote:
> > > > > >
> > > > > > Thanks for the reply. I am running at 12mhz, and
> > the I have a
> > > blinking
> > > > > > light that confirms that this is the case, along
> > with a decrease in
> > > > > > power draw. I am setting the multiplier(M) to 1. I
> > thought that you
> > > > > > had to specify the M and P values as well as select
> > the external
> > > > > > oscillator. Could this be screwing things up? How
> > does one avoid
> > > using
> > > > > > the PLL? on waking up from sleep mode, do you bother setting
> > > anything,
> > > > > > or should you actively disable the PLL by setting
> > PLLC and PLLE to
> > > 0?
> > > > > > I assume that Pclk would then =3D cclk.
> > > > > >
> > > > > > Thanks again for the advice
> > > > > >
> > > > > >
> > > > > > --- In l...@yahoogroups.com
> > ,
> > > > > > Sutton Mehaffey wrote:
> > > > > > >
> > > > > > > What's your Fosc? If it is 12, I don't think you
> > need to activate
> > > PLL0,
> > > > > > > if that's your CCLK speed.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ssonderhoff wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > > Perhaps I should re-state the question. The
> > PLLCFG and UART)
> > > settings
> > > > > > > > seem to be correct - Please let me know if you
> > can see some
> > > > > > mistake - Is
> > > > > > > > there anything else that could affect UART0
> > after a cclk change.
> > > The
> > > > > > > > port is active, but the output is garbage. Any
> > thoughts would be
> > > > > > welcome.
> > > > > > > >
> > > > > > > > --- In lpc2000@yahoogroups .com
> > > ,
> > > > > > > > "ssonderhoff" wrote:
> > > > > > > > >
> > > > > > > > > I am running the lpc2148 at a low clock speed
> > of 12 mhz to
> > > reduce
> > > > > > > > power usage. This is working, the power
> > consumption is down and
> > > a
> > > > > > light
> > > > > > > > blinks at the correct rate. for each speed I
> > reset the Uart0
> > > > > > parameters
> > > > > > > > to take the pclk into account (code below)
> > > > > > > > >
> > > > > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > > > > >
> > > > > > > > > At 60mhz Everything is working fine fine and
> > I can read the
> > > output
> > > > > > > > debug text without any problem.
> > > > > > > > >
> > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > have tried setting
> > > to
> > > > > > > > different baud rates from low to high with the
> > same result.
> > > > > > > > >
> > > > > > > > > The Uart settings were determined using the
> > NXP lpc2000
> > > calculator
> > > > > > > > >
> > > > > > > > > I believe that I have faithfully followed the
> > data sheet. Can
> > > > > > anyone
> > > > > > > > tell me what I am missing?
> > > > > > > > > Thanks,
> > > > > > > > > Stefan
> > > > > > > > >
> > > > > > > > > //*********CODE* ********* *
> > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > {
> > > > > > > > >
> > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting
> > Multiplier(5) and
> > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting
> > Multiplier(1) and
> > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > > >
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > PLL to lock to set
> > > > > > frequency
> > > > > > > > >
> > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock source
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > > //********** ********* ********* *********
> > ********* *********
> > > > > > > > ********* ***
> > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > {
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > {
> > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > bit, DLAB =3D 1
> > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > }
> > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > {
> > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > bit, DLAB =3D 1
> > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =3D 1 &
> > > mulval(7:4) =3D 12
> > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Sutton Mehaffey
> > >
> >
> >
> >
> >
> > ------------------------------------
> >
> >

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

RE: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - Any Advice would be app. - Archana Automation - Feb 9 5:42:03 2010

Sir,

Thanks for the details. Please quote with shipping through EMS and clarify
if you accept Paypal.

Thanks and Regards,

Mahesh Vyas.

From: l...@yahoogroups.com [mailto:l...@yahoogroups.com] On Behalf Of
Michael Anton
Sent: Tuesday, February 09, 2010 12:10 PM
To: l...@yahoogroups.com
Subject: RE: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk - not working
- Any Advice would be app.

> -----Original Message-----
> From: l...@yahoogroups.com
> [mailto:l...@yahoogroups.com ]On
Behalf
> Of ssonderhoff
> Sent: Monday, February 08, 2010 10:54 PM
> To: l...@yahoogroups.com
> Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> not working
> - Any Advice would be app.
>
> Hi,
> The system boots up using a boot loader that allows the unit
> to act as a thumb drive and access an SD card as well as load
> firmware updates from the sd card. This code initializes the
> system and sets the initial PLL and is difficult and
> dangerous for me to change. the code used to set PLL in the
> bootloader's Boot_up and system_init routines are shown below
> shown below:
>

Couldn't you write a piece of standalone test code, without
the bootloader, to test your routines when running at 12MHz?

>
> void boot_up(void)
> {
> //Initialize the MCU clock PLL
> system_init();
>
> IODIR0 |= (1 << 31);
> IOCLR0 |= (1 << 31); //Turn on USB LED
>
> //Init UART0 for debug
> PINSEL0 |= 0x00000005; //enable uart0
> U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
> U0DLM = 0x00;
> U0DLL = 0x20; // 115200 Baud Rate @ 58982400 VPB Clock

So are you using a 58982400Hz clock, or 60MHz? If this is not
60MHz, you will likely encounter USB problems, as obviously you
cannot reach 48MHz with enough accuracy either.

> U0LCR = 0x03; // DLAB = 0
>
> //Init rprintf
> rprintf_devopen(putc_serial0);
> rprintf("\n\n\nUSB Bootloader v1.1\n");
>
> //IOSET0 |= (1 << 31); //Turn off USB LED
> }
>
> /**********************************************************
> Initialize
> **********************************************************/
>
> #define PLOCK 0x400
>
> void system_init(void)
> {
> // Setting Multiplier and Divider values
> PLLCFG=0x24;
> feed();
>
> // Enabling the PLL */
> PLLCON=0x1;
> feed();
>
> // Wait for the PLL to lock to set frequency
> while(!(PLLSTAT & PLOCK)) ;
>
> // Connect the PLL as the clock source
> PLLCON=0x3;
> feed();
>
> // Enabling MAM and setting number of clocks used for
> Flash memory fetch (4 cclks in this case)
> //MAMTIM=0x3; //VCOM?
> MAMCR=0x2;
> MAMTIM=0x4; //Original

It may not matter, but I usually change the MAM timing values
prior to enabling the PLL. My rational is that if the values
are set wrong when already running at 60MHz, how could I expect
to reliably set them? Since there is no guarantee that I can read
from flash if they are set for a lower clock rate.

>
> // Setting peripheral Clock (pclk) to System Clock (cclk)
> VPBDIV=0x1;
> }

Like I said before, your initialization looks fine, but I suspect the
problem you are having might be elsewhere. So it would be useful to
see the rest of your serial port code. Perhaps there is some timing
issue that occurs when you run 5 times slower.

When I developed my UART code, I had all sorts of problems that would
occur at times, with seemingly no explanation, until I figured out
the problem. It was very non-obvious at the time.

So, if you can, break this down into a small piece of code that
demonstrates the problem, I'll take a look at it.

Mike

> --- In l...@yahoogroups.com ,
"Michael Anton" wrote:
> >
> > Perhaps you could post the balance of your UART code. The
> initialization
> > looks fine to me.
> >
> > Have you tried using only 12MHz, and not going into 60MHz?
> Just to see if
> > it is the changing
> > between the clock speeds that has something to do with the
> behaviour you are
> > seeing.
> >
> > Mike
> >
> > -----Original Message-----
> > From: l...@yahoogroups.com
> [mailto:l...@yahoogroups.com ]On
Behalf Of
> > ssonderhoff
> > Sent: Monday, February 08, 2010 8:46 PM
> > To: l...@yahoogroups.com
> > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> pclk - not working -
> > Any Advice would be app.
> >
> >
> >
> >
> > I will be appreciative for any insights, this is starting
> to get quite
> > frustrating.
> >
> > This is the code used to set the PLL to 60mhz. I modified
> it to not set
> > the PLL in slow mode (12mhz) on wake up and then eliminated
> going to this
> > code all together. all gave the same result. As i mentioned earlier,
> > everything works fine at 60mhz, where as at 12 mhz it has
> not worked with or
> > without setting PLL. UART settings are in the previous message
> >
> > Thanks again,
> > Stefan
> >
> > void PLL_init(int speed)
> > {
> >
> > if(speed==fast){PLLCFG=0x24;} // Setting
> Multiplier(5) and Divider(4)
> > so 5xosc (12mhz) = 60 mhz
> > else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60
> >
> > feed();
> >
> > PLLCON=0x1; // Enabling the PLL
> > feed();
> >
> > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > frequency
> >
> > PLLCON=0x3;// Connect the PLL as the clock source
> > feed();
> > }
> > --- In l...@yahoogroups.com ,
"ssonderhoff"
> wrote:
> > >
> > > I removed the setting the PLL - after wake up I do not set PLL -
> > > same problem - UART0 outputs garbage (see sample)
> > >
> > > 0£7*6@î0£7*6@®0£w*4@®0£w*4.
> > >
> > > the light on the serial connection is blinking and the
> junk is being
> > output at a regular interval. these are the settings used
> to set the baud
> > rate to 9600 - They seem correct to me
> > >
> > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > U0DLM = 0x00; //msb = 0
> > > U0DLL = 0x4E; //lsb = 78
> > > U0FCR = 0x07; // enable and reset
> > > U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> > > //VICIntEnClr = 0x00000040;
> > > U0IER = 0x00;
> > >
> > > I am at a loss and would appreciate any help
> > > Stefan
> > >
> > >
> > >
> > > --- In l...@yahoogroups.com ,
Sutton Mehaffey sutton@ wrote:
> > > >
> > > > I don't turn PLL on when I use PCLK=CCLK. Mine works
> fine. Try it and
> > > > see if it fixes your problem. I think you only need
> PLL on if you need
> > > > more speed than PCLK.
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > > Thanks for the reply. I am running at 12mhz, and
> the I have a
> > blinking
> > > > > light that confirms that this is the case, along
> with a decrease in
> > > > > power draw. I am setting the multiplier(M) to 1. I
> thought that you
> > > > > had to specify the M and P values as well as select
> the external
> > > > > oscillator. Could this be screwing things up? How
> does one avoid
> > using
> > > > > the PLL? on waking up from sleep mode, do you bother setting
> > anything,
> > > > > or should you actively disable the PLL by setting
> PLLC and PLLE to
> > 0?
> > > > > I assume that Pclk would then = cclk.
> > > > >
> > > > > Thanks again for the advice
> > > > >
> > > > >
> > > > > --- In l...@yahoogroups.com
> ,
> > > > > Sutton Mehaffey wrote:
> > > > > >
> > > > > > What's your Fosc? If it is 12, I don't think you
> need to activate
> > PLL0,
> > > > > > if that's your CCLK speed.
> > > > > >
> > > > > >
> > > > > >
> > > > > > ssonderhoff wrote:
> > > > > > >
> > > > > > >
> > > > > > > Perhaps I should re-state the question. The
> PLLCFG and UART)
> > settings
> > > > > > > seem to be correct - Please let me know if you
> can see some
> > > > > mistake - Is
> > > > > > > there anything else that could affect UART0
> after a cclk change.
> > The
> > > > > > > port is active, but the output is garbage. Any
> thoughts would be
> > > > > welcome.
> > > > > > >
> > > > > > > --- In lpc2000@yahoogroups .com
> > ,
> > > > > > > "ssonderhoff" wrote:
> > > > > > > >
> > > > > > > > I am running the lpc2148 at a low clock speed
> of 12 mhz to
> > reduce
> > > > > > > power usage. This is working, the power
> consumption is down and
> > a
> > > > > light
> > > > > > > blinks at the correct rate. for each speed I
> reset the Uart0
> > > > > parameters
> > > > > > > to take the pclk into account (code below)
> > > > > > > >
> > > > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > > > >
> > > > > > > > At 60mhz Everything is working fine fine and
> I can read the
> > output
> > > > > > > debug text without any problem.
> > > > > > > >
> > > > > > > > At 12 mhz it outputs nothing but garbage, I
> have tried setting
> > to
> > > > > > > different baud rates from low to high with the
> same result.
> > > > > > > >
> > > > > > > > The Uart settings were determined using the
> NXP lpc2000
> > calculator
> > > > > > > >
> > > > > > > > I believe that I have faithfully followed the
> data sheet. Can
> > > > > anyone
> > > > > > > tell me what I am missing?
> > > > > > > > Thanks,
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > > //*********CODE* ********* *
> > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > {
> > > > > > > >
> > > > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting
> Multiplier(5) and
> > > > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting
> Multiplier(1) and
> > > > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > > > >
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> PLL to lock to set
> > > > > frequency
> > > > > > > >
> > > > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > }
> > > > > > > > //********** ********* ********* *********
> ********* *********
> > > > > > > ********* ***
> > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > {
> > > > > > > >
> > > > > > > >
> > > > > > > > if(speed==fast)
> > > > > > > > {
> > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> bit, DLAB = 1
> > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > U0IER = 0x00;
> > > > > > > > }
> > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > {
> > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> bit, DLAB = 1
> > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
> > mulval(7:4) = 12
> > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > U0LCR = 0x03;
> > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > U0IER = 0x00;
> > > > > > > > }
> > > > > > > >
> > > > > > > > }
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > Sutton Mehaffey
> >
> ------------------------------------
>
> Yahoo! Groups Links
>

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 9:15:25 2010

Though I am not sure why. It turns out that if you shut off the PLL and cha=
nge UART) settings before you put the system to sleep, then the output is t=
he desired text. If you go to sleep and then run the identical code the out=
put is the garbled nonsense I was getting. Any Ideas why this might be the =
case?
Thanks All,
Stefan

--- In l...@yahoogroups.com, "ssonderhoff" wrote:
>
>=20
> The board comes with the bootloader loaded and I have loaded all my firmw=
are using the bootlader. I would hate to overwrite the bootloader and not b=
e able to program the board. my test program puts the computer to sleep and=
then on wake up resets PLL or not, sets uart and then goes into a loop and=
contsantly prints out a string. At 60mhz everythng works and 12, not so mu=
ch.
> Stefan
>=20
>=20=20
> --- In l...@yahoogroups.com, "Michael Anton" wrote:
> >
> >=20
> >=20
> > > -----Original Message-----
> > > From: l...@yahoogroups.com
> > > [mailto:l...@yahoogroups.com]On Behalf
> > > Of ssonderhoff
> > > Sent: Monday, February 08, 2010 10:54 PM
> > > To: l...@yahoogroups.com
> > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > not working
> > > - Any Advice would be app.
> > >
> > >
> > >
> > > Hi,
> > > The system boots up using a boot loader that allows the unit
> > > to act as a thumb drive and access an SD card as well as load
> > > firmware updates from the sd card. This code initializes the
> > > system and sets the initial PLL and is difficult and
> > > dangerous for me to change. the code used to set PLL in the
> > > bootloader's Boot_up and system_init routines are shown below
> > > shown below:
> > >
> >=20
> > Couldn't you write a piece of standalone test code, without
> > the bootloader, to test your routines when running at 12MHz?
> >=20
> > >
> > > void boot_up(void)
> > > {
> > > //Initialize the MCU clock PLL
> > > system_init();
> > >
> > > IODIR0 |=3D (1 << 31);
> > > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> > >
> > > //Init UART0 for debug
> > > PINSEL0 |=3D 0x00000005; //enable uart0
> > > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1
> > > U0DLM =3D 0x00;
> > > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> >=20
> > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > 60MHz, you will likely encounter USB problems, as obviously you
> > cannot reach 48MHz with enough accuracy either.
> >=20
> > > U0LCR =3D 0x03; // DLAB =3D 0
> > >
> > > //Init rprintf
> > > rprintf_devopen(putc_serial0);
> > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > >
> > > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > > }
> > >
> > > /**********************************************************
> > > Initialize
> > > **********************************************************/
> > >
> > > #define PLOCK 0x400
> > >
> > > void system_init(void)
> > > {
> > > // Setting Multiplier and Divider values
> > > PLLCFG=3D0x24;
> > > feed();
> > >
> > > // Enabling the PLL */
> > > PLLCON=3D0x1;
> > > feed();
> > >
> > > // Wait for the PLL to lock to set frequency
> > > while(!(PLLSTAT & PLOCK)) ;
> > >
> > > // Connect the PLL as the clock source
> > > PLLCON=3D0x3;
> > > feed();
> > >
> > > // Enabling MAM and setting number of clocks used for
> > > Flash memory fetch (4 cclks in this case)
> > > //MAMTIM=3D0x3; //VCOM?
> > > MAMCR=3D0x2;
> > > MAMTIM=3D0x4; //Original
> >=20
> > It may not matter, but I usually change the MAM timing values
> > prior to enabling the PLL. My rational is that if the values
> > are set wrong when already running at 60MHz, how could I expect
> > to reliably set them? Since there is no guarantee that I can read
> > from flash if they are set for a lower clock rate.
> >=20
> > >
> > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > VPBDIV=3D0x1;
> > > }
> > >
> > >
> >=20
> > Like I said before, your initialization looks fine, but I suspect the
> > problem you are having might be elsewhere. So it would be useful to
> > see the rest of your serial port code. Perhaps there is some timing
> > issue that occurs when you run 5 times slower.
> >=20
> > When I developed my UART code, I had all sorts of problems that would
> > occur at times, with seemingly no explanation, until I figured out
> > the problem. It was very non-obvious at the time.
> >=20
> > So, if you can, break this down into a small piece of code that
> > demonstrates the problem, I'll take a look at it.
> >=20
> > Mike
> >=20
> >=20
> >=20
> > > --- In l...@yahoogroups.com, "Michael Anton" wrote:
> > > >
> > > > Perhaps you could post the balance of your UART code. The
> > > initialization
> > > > looks fine to me.
> > > >
> > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > Just to see if
> > > > it is the changing
> > > > between the clock speeds that has something to do with the
> > > behaviour you are
> > > > seeing.
> > > >
> > > > Mike
> > > >
> > > > -----Original Message-----
> > > > From: l...@yahoogroups.com
> > > [mailto:l...@yahoogroups.com]On Behalf Of
> > > > ssonderhoff
> > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > To: l...@yahoogroups.com
> > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > pclk - not working -
> > > > Any Advice would be app.
> > > >
> > > >
> > > >
> > > >
> > > > I will be appreciative for any insights, this is starting
> > > to get quite
> > > > frustrating.
> > > >
> > > > This is the code used to set the PLL to 60mhz. I modified
> > > it to not set
> > > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > > going to this
> > > > code all together. all gave the same result. As i mentioned earlier=
,
> > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > not worked with or
> > > > without setting PLL. UART settings are in the previous message
> > > >
> > > > Thanks again,
> > > > Stefan
> > > >
> > > > void PLL_init(int speed)
> > > > {
> > > >
> > > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > > Multiplier(5) and Divider(4)
> > > > so 5xosc (12mhz) =3D 60 mhz
> > > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x60
> > > >
> > > > feed();
> > > >
> > > > PLLCON=3D0x1; // Enabling the PLL
> > > > feed();
> > > >
> > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > > frequency
> > > >
> > > > PLLCON=3D0x3;// Connect the PLL as the clock source
> > > > feed();
> > > > }
> > > > --- In l...@yahoogroups.com, "ssonderhoff"
> > > wrote:
> > > > >
> > > > > I removed the setting the PLL - after wake up I do not set PLL =
-
> > > > > same problem - UART0 outputs garbage (see sample)
> > > > >
> > > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.
> > > > >
> > > > > the light on the serial connection is blinking and the
> > > junk is being
> > > > output at a regular interval. these are the settings used
> > > to set the baud
> > > > rate to 9600 - They seem correct to me
> > > > >
> > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > > U0FCR =3D 0x07; // enable and reset
> > > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > > > > //VICIntEnClr =3D 0x00000040;
> > > > > U0IER =3D 0x00;
> > > > >
> > > > > I am at a loss and would appreciate any help
> > > > > Stefan
> > > > >
> > > > >
> > > > >
> > > > > --- In l...@yahoogroups.com, Sutton Mehaffey sutton@ wrote:
> > > > > >
> > > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works
> > > fine. Try it and
> > > > > > see if it fixes your problem. I think you only need
> > > PLL on if you need
> > > > > > more speed than PCLK.
> > > > > >
> > > > > > ssonderhoff wrote:
> > > > > > >
> > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > the I have a
> > > > blinking
> > > > > > > light that confirms that this is the case, along
> > > with a decrease in
> > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > thought that you
> > > > > > > had to specify the M and P values as well as select
> > > the external
> > > > > > > oscillator. Could this be screwing things up? How
> > > does one avoid
> > > > using
> > > > > > > the PLL? on waking up from sleep mode, do you bother settin=
g
> > > > anything,
> > > > > > > or should you actively disable the PLL by setting
> > > PLLC and PLLE to
> > > > 0?
> > > > > > > I assume that Pclk would then =3D cclk.
> > > > > > >
> > > > > > > Thanks again for the advice
> > > > > > >
> > > > > > >
> > > > > > > --- In l...@yahoogroups.com
> > > ,
> > > > > > > Sutton Mehaffey wrote:
> > > > > > > >
> > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > need to activate
> > > > PLL0,
> > > > > > > > if that's your CCLK speed.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ssonderhoff wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Perhaps I should re-state the question. The
> > > PLLCFG and UART)
> > > > settings
> > > > > > > > > seem to be correct - Please let me know if you
> > > can see some
> > > > > > > mistake - Is
> > > > > > > > > there anything else that could affect UART0
> > > after a cclk change.
> > > > The
> > > > > > > > > port is active, but the output is garbage. Any
> > > thoughts would be
> > > > > > > welcome.
> > > > > > > > >
> > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > ,
> > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > >
> > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > of 12 mhz to
> > > > reduce
> > > > > > > > > power usage. This is working, the power
> > > consumption is down and
> > > > a
> > > > > > > light
> > > > > > > > > blinks at the correct rate. for each speed I
> > > reset the Uart0
> > > > > > > parameters
> > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > >
> > > > > > > > > > the PLL_int(code below) sets processor to 12mhz(slow)=
.
> > > > > > > > > >
> > > > > > > > > > At 60mhz Everything is working fine fine and
> > > I can read the
> > > > output
> > > > > > > > > debug text without any problem.
> > > > > > > > > >
> > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > have tried setting
> > > > to
> > > > > > > > > different baud rates from low to high with the
> > > same result.
> > > > > > > > > >
> > > > > > > > > > The Uart settings were determined using the
> > > NXP lpc2000
> > > > calculator
> > > > > > > > > >
> > > > > > > > > > I believe that I have faithfully followed the
> > > data sheet. Can
> > > > > > > anyone
> > > > > > > > > tell me what I am missing?
> > > > > > > > > > Thanks,
> > > > > > > > > > Stefan
> > > > > > > > > >
> > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > {
> > > > > > > > > >
> > > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting
> > > Multiplier(5) and
> > > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting
> > > Multiplier(1) and
> > > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > > > >
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > PLL to lock to set
> > > > > > > frequency
> > > > > > > > > >
> > > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock source
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > }
> > > > > > > > > > //********** ********* ********* *********
> > > ********* *********
> > > > > > > > > ********* ***
> > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > {
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > > {
> > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > bit, DLAB =3D 1
> > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > }
> > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > {
> > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > bit, DLAB =3D 1
> > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =3D 1=
&
> > > > mulval(7:4) =3D 12
> > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Sutton Mehaffey
> > > >
> > >
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > >

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - Sutton Mehaffey - Feb 9 9:28:32 2010

How are you waking the system back up? Pressing reset?

ssonderhoff wrote:
>
>
> Though I am not sure why. It turns out that if you shut off the PLL and
> change UART) settings before you put the system to sleep, then the
> output is the desired text. If you go to sleep and then run the
> identical code the output is the garbled nonsense I was getting. Any
> Ideas why this might be the case?
> Thanks All,
> Stefan
>
> --- In l...@yahoogroups.com ,
> "ssonderhoff" wrote:
> >
> >
> > The board comes with the bootloader loaded and I have loaded all my
> firmware using the bootlader. I would hate to overwrite the bootloader
> and not be able to program the board. my test program puts the computer
> to sleep and then on wake up resets PLL or not, sets uart and then goes
> into a loop and contsantly prints out a string. At 60mhz everythng works
> and 12, not so much.
> > Stefan
> >
> >
> > --- In l...@yahoogroups.com ,
> "Michael Anton" wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: l...@yahoogroups.com
> > > > [mailto:l...@yahoogroups.com
> ]On Behalf
> > > > Of ssonderhoff
> > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > To: l...@yahoogroups.com
> > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > > not working
> > > > - Any Advice would be app.
> > > >
> > > >
> > > >
> > > > Hi,
> > > > The system boots up using a boot loader that allows the unit
> > > > to act as a thumb drive and access an SD card as well as load
> > > > firmware updates from the sd card. This code initializes the
> > > > system and sets the initial PLL and is difficult and
> > > > dangerous for me to change. the code used to set PLL in the
> > > > bootloader's Boot_up and system_init routines are shown below
> > > > shown below:
> > > >
> > >
> > > Couldn't you write a piece of standalone test code, without
> > > the bootloader, to test your routines when running at 12MHz?
> > >
> > > >
> > > > void boot_up(void)
> > > > {
> > > > //Initialize the MCU clock PLL
> > > > system_init();
> > > >
> > > > IODIR0 |= (1 << 31);
> > > > IOCLR0 |= (1 << 31); //Turn on USB LED
> > > >
> > > > //Init UART0 for debug
> > > > PINSEL0 |= 0x00000005; //enable uart0
> > > > U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
> > > > U0DLM = 0x00;
> > > > U0DLL = 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > >
> > > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > > 60MHz, you will likely encounter USB problems, as obviously you
> > > cannot reach 48MHz with enough accuracy either.
> > >
> > > > U0LCR = 0x03; // DLAB = 0
> > > >
> > > > //Init rprintf
> > > > rprintf_devopen(putc_serial0);
> > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > >
> > > > //IOSET0 |= (1 << 31); //Turn off USB LED
> > > > }
> > > >
> > > > /**********************************************************
> > > > Initialize
> > > > **********************************************************/
> > > >
> > > > #define PLOCK 0x400
> > > >
> > > > void system_init(void)
> > > > {
> > > > // Setting Multiplier and Divider values
> > > > PLLCFG=0x24;
> > > > feed();
> > > >
> > > > // Enabling the PLL */
> > > > PLLCON=0x1;
> > > > feed();
> > > >
> > > > // Wait for the PLL to lock to set frequency
> > > > while(!(PLLSTAT & PLOCK)) ;
> > > >
> > > > // Connect the PLL as the clock source
> > > > PLLCON=0x3;
> > > > feed();
> > > >
> > > > // Enabling MAM and setting number of clocks used for
> > > > Flash memory fetch (4 cclks in this case)
> > > > //MAMTIM=0x3; //VCOM?
> > > > MAMCR=0x2;
> > > > MAMTIM=0x4; //Original
> > >
> > > It may not matter, but I usually change the MAM timing values
> > > prior to enabling the PLL. My rational is that if the values
> > > are set wrong when already running at 60MHz, how could I expect
> > > to reliably set them? Since there is no guarantee that I can read
> > > from flash if they are set for a lower clock rate.
> > >
> > > >
> > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > VPBDIV=0x1;
> > > > }
> > > >
> > > >
> > >
> > > Like I said before, your initialization looks fine, but I suspect the
> > > problem you are having might be elsewhere. So it would be useful to
> > > see the rest of your serial port code. Perhaps there is some timing
> > > issue that occurs when you run 5 times slower.
> > >
> > > When I developed my UART code, I had all sorts of problems that would
> > > occur at times, with seemingly no explanation, until I figured out
> > > the problem. It was very non-obvious at the time.
> > >
> > > So, if you can, break this down into a small piece of code that
> > > demonstrates the problem, I'll take a look at it.
> > >
> > > Mike
> > >
> > >
> > >
> > > > --- In l...@yahoogroups.com
> , "Michael Anton" wrote:
> > > > >
> > > > > Perhaps you could post the balance of your UART code. The
> > > > initialization
> > > > > looks fine to me.
> > > > >
> > > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > > Just to see if
> > > > > it is the changing
> > > > > between the clock speeds that has something to do with the
> > > > behaviour you are
> > > > > seeing.
> > > > >
> > > > > Mike
> > > > >
> > > > > -----Original Message-----
> > > > > From: l...@yahoogroups.com
> > > > [mailto:l...@yahoogroups.com
> ]On Behalf Of
> > > > > ssonderhoff
> > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > To: l...@yahoogroups.com
> > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > pclk - not working -
> > > > > Any Advice would be app.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > I will be appreciative for any insights, this is starting
> > > > to get quite
> > > > > frustrating.
> > > > >
> > > > > This is the code used to set the PLL to 60mhz. I modified
> > > > it to not set
> > > > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > > > going to this
> > > > > code all together. all gave the same result. As i mentioned
> earlier,
> > > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > > not worked with or
> > > > > without setting PLL. UART settings are in the previous message
> > > > >
> > > > > Thanks again,
> > > > > Stefan
> > > > >
> > > > > void PLL_init(int speed)
> > > > > {
> > > > >
> > > > > if(speed==fast){PLLCFG=0x24;} // Setting
> > > > Multiplier(5) and Divider(4)
> > > > > so 5xosc (12mhz) = 60 mhz
> > > > > else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60
> > > > >
> > > > > feed();
> > > > >
> > > > > PLLCON=0x1; // Enabling the PLL
> > > > > feed();
> > > > >
> > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > > > frequency
> > > > >
> > > > > PLLCON=0x3;// Connect the PLL as the clock source
> > > > > feed();
> > > > > }
> > > > > --- In l...@yahoogroups.com
> , "ssonderhoff"
> > > > wrote:
> > > > > >
> > > > > > I removed the setting the PLL - after wake up I do not set PLL -
> > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > >
> > > > > > 0£7*6@î0£7*6@®0£w*4@®0£w*4.
> > > > > >
> > > > > > the light on the serial connection is blinking and the
> > > > junk is being
> > > > > output at a regular interval. these are the settings used
> > > > to set the baud
> > > > > rate to 9600 - They seem correct to me
> > > > > >
> > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > U0DLM = 0x00; //msb = 0
> > > > > > U0DLL = 0x4E; //lsb = 78
> > > > > > U0FCR = 0x07; // enable and reset
> > > > > > U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> > > > > > //VICIntEnClr = 0x00000040;
> > > > > > U0IER = 0x00;
> > > > > >
> > > > > > I am at a loss and would appreciate any help
> > > > > > Stefan
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- In l...@yahoogroups.com
> , Sutton Mehaffey sutton@ wrote:
> > > > > > >
> > > > > > > I don't turn PLL on when I use PCLK=CCLK. Mine works
> > > > fine. Try it and
> > > > > > > see if it fixes your problem. I think you only need
> > > > PLL on if you need
> > > > > > > more speed than PCLK.
> > > > > > >
> > > > > > > ssonderhoff wrote:
> > > > > > > >
> > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > the I have a
> > > > > blinking
> > > > > > > > light that confirms that this is the case, along
> > > > with a decrease in
> > > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > > thought that you
> > > > > > > > had to specify the M and P values as well as select
> > > > the external
> > > > > > > > oscillator. Could this be screwing things up? How
> > > > does one avoid
> > > > > using
> > > > > > > > the PLL? on waking up from sleep mode, do you bother setting
> > > > > anything,
> > > > > > > > or should you actively disable the PLL by setting
> > > > PLLC and PLLE to
> > > > > 0?
> > > > > > > > I assume that Pclk would then = cclk.
> > > > > > > >
> > > > > > > > Thanks again for the advice
> > > > > > > >
> > > > > > > >
> > > > > > > > --- In l...@yahoogroups.com
>
> > > > ,
> > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > >
> > > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > > need to activate
> > > > > PLL0,
> > > > > > > > > if that's your CCLK speed.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > ssonderhoff wrote:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Perhaps I should re-state the question. The
> > > > PLLCFG and UART)
> > > > > settings
> > > > > > > > > > seem to be correct - Please let me know if you
> > > > can see some
> > > > > > > > mistake - Is
> > > > > > > > > > there anything else that could affect UART0
> > > > after a cclk change.
> > > > > The
> > > > > > > > > > port is active, but the output is garbage. Any
> > > > thoughts would be
> > > > > > > > welcome.
> > > > > > > > > >
> > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > ,
> > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > >
> > > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > > of 12 mhz to
> > > > > reduce
> > > > > > > > > > power usage. This is working, the power
> > > > consumption is down and
> > > > > a
> > > > > > > > light
> > > > > > > > > > blinks at the correct rate. for each speed I
> > > > reset the Uart0
> > > > > > > > parameters
> > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > >
> > > > > > > > > > > the PLL_int(code below) sets processor to 12mhz(slow).
> > > > > > > > > > >
> > > > > > > > > > > At 60mhz Everything is working fine fine and
> > > > I can read the
> > > > > output
> > > > > > > > > > debug text without any problem.
> > > > > > > > > > >
> > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > have tried setting
> > > > > to
> > > > > > > > > > different baud rates from low to high with the
> > > > same result.
> > > > > > > > > > >
> > > > > > > > > > > The Uart settings were determined using the
> > > > NXP lpc2000
> > > > > calculator
> > > > > > > > > > >
> > > > > > > > > > > I believe that I have faithfully followed the
> > > > data sheet. Can
> > > > > > > > anyone
> > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > Thanks,
> > > > > > > > > > > Stefan
> > > > > > > > > > >
> > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > > {
> > > > > > > > > > >
> > > > > > > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting
> > > > Multiplier(5) and
> > > > > > > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting
> > > > Multiplier(1) and
> > > > > > > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > > > > > > >
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > PLL to lock to set
> > > > > > > > frequency
> > > > > > > > > > >
> > > > > > > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > }
> > > > > > > > > > > //********** ********* ********* *********
> > > > ********* *********
> > > > > > > > > > ********* ***
> > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > {
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > if(speed==fast)
> > > > > > > > > > > {
> > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > bit, DLAB = 1
> > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > }
> > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > {
> > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > bit, DLAB = 1
> > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
> > > > > mulval(7:4) = 12
> > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > U0LCR = 0x03;
> > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Sutton Mehaffey
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 14:13:10 2010

I am using EINT3 (non vectored).=20

Once cclk was changed to 12 mhz before going to sleep, the uart0 worked fin=
e before and after sleep. I have changed the baud rate up to 115200 and it =
still is working fine.=20

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> How are you waking the system back up? Pressing reset?
>=20
>=20
>=20
> ssonderhoff wrote:
> >=20=20
> >=20
> > Though I am not sure why. It turns out that if you shut off the PLL and=
=20
> > change UART) settings before you put the system to sleep, then the=20
> > output is the desired text. If you go to sleep and then run the=20
> > identical code the output is the garbled nonsense I was getting. Any=20
> > Ideas why this might be the case?
> > Thanks All,
> > Stefan
> >=20
> > --- In l...@yahoogroups.com ,=20
> > "ssonderhoff" wrote:
> > >
> > >
> > > The board comes with the bootloader loaded and I have loaded all my=
=20
> > firmware using the bootlader. I would hate to overwrite the bootloader=
=20
> > and not be able to program the board. my test program puts the computer=
=20
> > to sleep and then on wake up resets PLL or not, sets uart and then goes=
=20
> > into a loop and contsantly prints out a string. At 60mhz everythng work=
s=20
> > and 12, not so much.
> > > Stefan
> > >
> > >
> > > --- In l...@yahoogroups.com ,=20
> > "Michael Anton" wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: l...@yahoogroups.com
> > > > > [mailto:l...@yahoogroups.com=20
> > ]On Behalf
> > > > > Of ssonderhoff
> > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > To: l...@yahoogroups.com
> > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > > > not working
> > > > > - Any Advice would be app.
> > > > >
> > > > >
> > > > >
> > > > > Hi,
> > > > > The system boots up using a boot loader that allows the unit
> > > > > to act as a thumb drive and access an SD card as well as load
> > > > > firmware updates from the sd card. This code initializes the
> > > > > system and sets the initial PLL and is difficult and
> > > > > dangerous for me to change. the code used to set PLL in the
> > > > > bootloader's Boot_up and system_init routines are shown below
> > > > > shown below:
> > > > >
> > > >
> > > > Couldn't you write a piece of standalone test code, without
> > > > the bootloader, to test your routines when running at 12MHz?
> > > >
> > > > >
> > > > > void boot_up(void)
> > > > > {
> > > > > //Initialize the MCU clock PLL
> > > > > system_init();
> > > > >
> > > > > IODIR0 |=3D (1 << 31);
> > > > > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> > > > >
> > > > > //Init UART0 for debug
> > > > > PINSEL0 |=3D 0x00000005; //enable uart0
> > > > > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1
> > > > > U0DLM =3D 0x00;
> > > > > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > >
> > > > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > > > 60MHz, you will likely encounter USB problems, as obviously you
> > > > cannot reach 48MHz with enough accuracy either.
> > > >
> > > > > U0LCR =3D 0x03; // DLAB =3D 0
> > > > >
> > > > > //Init rprintf
> > > > > rprintf_devopen(putc_serial0);
> > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > >
> > > > > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > > > > }
> > > > >
> > > > > /**********************************************************
> > > > > Initialize
> > > > > **********************************************************/
> > > > >
> > > > > #define PLOCK 0x400
> > > > >
> > > > > void system_init(void)
> > > > > {
> > > > > // Setting Multiplier and Divider values
> > > > > PLLCFG=3D0x24;
> > > > > feed();
> > > > >
> > > > > // Enabling the PLL */
> > > > > PLLCON=3D0x1;
> > > > > feed();
> > > > >
> > > > > // Wait for the PLL to lock to set frequency
> > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > >
> > > > > // Connect the PLL as the clock source
> > > > > PLLCON=3D0x3;
> > > > > feed();
> > > > >
> > > > > // Enabling MAM and setting number of clocks used for
> > > > > Flash memory fetch (4 cclks in this case)
> > > > > //MAMTIM=3D0x3; //VCOM?
> > > > > MAMCR=3D0x2;
> > > > > MAMTIM=3D0x4; //Original
> > > >
> > > > It may not matter, but I usually change the MAM timing values
> > > > prior to enabling the PLL. My rational is that if the values
> > > > are set wrong when already running at 60MHz, how could I expect
> > > > to reliably set them? Since there is no guarantee that I can read
> > > > from flash if they are set for a lower clock rate.
> > > >
> > > > >
> > > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > > VPBDIV=3D0x1;
> > > > > }
> > > > >
> > > > >
> > > >
> > > > Like I said before, your initialization looks fine, but I suspect =
the
> > > > problem you are having might be elsewhere. So it would be useful t=
o
> > > > see the rest of your serial port code. Perhaps there is some timin=
g
> > > > issue that occurs when you run 5 times slower.
> > > >
> > > > When I developed my UART code, I had all sorts of problems that wo=
uld
> > > > occur at times, with seemingly no explanation, until I figured out
> > > > the problem. It was very non-obvious at the time.
> > > >
> > > > So, if you can, break this down into a small piece of code that
> > > > demonstrates the problem, I'll take a look at it.
> > > >
> > > > Mike
> > > >
> > > >
> > > >
> > > > > --- In l...@yahoogroups.com=20
> > , "Michael Anton" wrote:
> > > > > >
> > > > > > Perhaps you could post the balance of your UART code. The
> > > > > initialization
> > > > > > looks fine to me.
> > > > > >
> > > > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > > > Just to see if
> > > > > > it is the changing
> > > > > > between the clock speeds that has something to do with the
> > > > > behaviour you are
> > > > > > seeing.
> > > > > >
> > > > > > Mike
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: l...@yahoogroups.com m>
> > > > > [mailto:l...@yahoogroups.com=20
> > ]On Behalf Of
> > > > > > ssonderhoff
> > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > To: l...@yahoogroups.com
> > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > pclk - not working -
> > > > > > Any Advice would be app.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > I will be appreciative for any insights, this is starting
> > > > > to get quite
> > > > > > frustrating.
> > > > > >
> > > > > > This is the code used to set the PLL to 60mhz. I modified
> > > > > it to not set
> > > > > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > > > > going to this
> > > > > > code all together. all gave the same result. As i mentioned=20
> > earlier,
> > > > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > > > not worked with or
> > > > > > without setting PLL. UART settings are in the previous message
> > > > > >
> > > > > > Thanks again,
> > > > > > Stefan
> > > > > >
> > > > > > void PLL_init(int speed)
> > > > > > {
> > > > > >
> > > > > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > > > > Multiplier(5) and Divider(4)
> > > > > > so 5xosc (12mhz) =3D 60 mhz
> > > > > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x60
> > > > > >
> > > > > > feed();
> > > > > >
> > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > feed();
> > > > > >
> > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > > > > frequency
> > > > > >
> > > > > > PLLCON=3D0x3;// Connect the PLL as the clock source
> > > > > > feed();
> > > > > > }
> > > > > > --- In l...@yahoogroups.com=20
> > , "ssonderhoff"
> > > > > wrote:
> > > > > > >
> > > > > > > I removed the setting the PLL - after wake up I do not set P=
LL -
> > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > >
> > > > > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w*4.
> > > > > > >
> > > > > > > the light on the serial connection is blinking and the
> > > > > junk is being
> > > > > > output at a regular interval. these are the settings used
> > > > > to set the baud
> > > > > > rate to 9600 - They seem correct to me
> > > > > > >
> > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =3D 1
> > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > > > > > > //VICIntEnClr =3D 0x00000040;
> > > > > > > U0IER =3D 0x00;
> > > > > > >
> > > > > > > I am at a loss and would appreciate any help
> > > > > > > Stefan
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --- In l...@yahoogroups.com=20
> > , Sutton Mehaffey sutton@ wrote:
> > > > > > > >
> > > > > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works
> > > > > fine. Try it and
> > > > > > > > see if it fixes your problem. I think you only need
> > > > > PLL on if you need
> > > > > > > > more speed than PCLK.
> > > > > > > >
> > > > > > > > ssonderhoff wrote:
> > > > > > > > >
> > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > the I have a
> > > > > > blinking
> > > > > > > > > light that confirms that this is the case, along
> > > > > with a decrease in
> > > > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > > > thought that you
> > > > > > > > > had to specify the M and P values as well as select
> > > > > the external
> > > > > > > > > oscillator. Could this be screwing things up? How
> > > > > does one avoid
> > > > > > using
> > > > > > > > > the PLL? on waking up from sleep mode, do you bother set=
ting
> > > > > > anything,
> > > > > > > > > or should you actively disable the PLL by setting
> > > > > PLLC and PLLE to
> > > > > > 0?
> > > > > > > > > I assume that Pclk would then =3D cclk.
> > > > > > > > >
> > > > > > > > > Thanks again for the advice
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > > ,
> > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > >
> > > > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > > > need to activate
> > > > > > PLL0,
> > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > PLLCFG and UART)
> > > > > > settings
> > > > > > > > > > > seem to be correct - Please let me know if you
> > > > > can see some
> > > > > > > > > mistake - Is
> > > > > > > > > > > there anything else that could affect UART0
> > > > > after a cclk change.
> > > > > > The
> > > > > > > > > > > port is active, but the output is garbage. Any
> > > > > thoughts would be
> > > > > > > > > welcome.
> > > > > > > > > > >
> > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > ,
> > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > > > of 12 mhz to
> > > > > > reduce
> > > > > > > > > > > power usage. This is working, the power
> > > > > consumption is down and
> > > > > > a
> > > > > > > > > light
> > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > reset the Uart0
> > > > > > > > > parameters
> > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > >
> > > > > > > > > > > > the PLL_int(code below) sets processor to 12mhz(sl=
ow).
> > > > > > > > > > > >
> > > > > > > > > > > > At 60mhz Everything is working fine fine and
> > > > > I can read the
> > > > > > output
> > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > >
> > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > > have tried setting
> > > > > > to
> > > > > > > > > > > different baud rates from low to high with the
> > > > > same result.
> > > > > > > > > > > >
> > > > > > > > > > > > The Uart settings were determined using the
> > > > > NXP lpc2000
> > > > > > calculator
> > > > > > > > > > > >
> > > > > > > > > > > > I believe that I have faithfully followed the
> > > > > data sheet. Can
> > > > > > > > > anyone
> > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > Thanks,
> > > > > > > > > > > > Stefan
> > > > > > > > > > > >
> > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > > > {
> > > > > > > > > > > >
> > > > > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setting
> > > > > Multiplier(5) and
> > > > > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting
> > > > > Multiplier(1) and
> > > > > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > > > > > >
> > > > > > > > > > > > feed();
> > > > > > > > > > > >
> > > > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > > > feed();
> > > > > > > > > > > >
> > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > PLL to lock to set
> > > > > > > > > frequency
> > > > > > > > > > > >
> > > > > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock sour=
ce
> > > > > > > > > > > > feed();
> > > > > > > > > > > >
> > > > > > > > > > > > }
> > > > > > > > > > > > //********** ********* ********* *********
> > > > > ********* *********
> > > > > > > > > > > ********* ***
> > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > {
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > > > > {
> > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > > > bit, DLAB =3D 1
> > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > }
> > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > {
> > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > > > bit, DLAB =3D 1
> > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0) =
=3D 1 &
> > > > > > mulval(7:4) =3D 12
> > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > }
> > > > > > > > > > > >
> > > > > > > > > > > > }
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Sutton Mehaffey
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------------
> > > > >
> > > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - Sutton Mehaffey - Feb 9 14:33:07 2010

I don't think that interrupt resets the PLL does it? You might need to
reset it to OFF manually.

ssonderhoff wrote:
>
>
> I am using EINT3 (non vectored).
>
> Once cclk was changed to 12 mhz before going to sleep, the uart0 worked
> fine before and after sleep. I have changed the baud rate up to 115200
> and it still is working fine.
>
> --- In l...@yahoogroups.com ,
> Sutton Mehaffey wrote:
> >
> > How are you waking the system back up? Pressing reset?
> >
> >
> >
> > ssonderhoff wrote:
> > >
> > >
> > > Though I am not sure why. It turns out that if you shut off the PLL
> and
> > > change UART) settings before you put the system to sleep, then the
> > > output is the desired text. If you go to sleep and then run the
> > > identical code the output is the garbled nonsense I was getting. Any
> > > Ideas why this might be the case?
> > > Thanks All,
> > > Stefan
> > >
> > > --- In l...@yahoogroups.com
> ,
> > > "ssonderhoff" wrote:
> > > >
> > > >
> > > > The board comes with the bootloader loaded and I have loaded all my
> > > firmware using the bootlader. I would hate to overwrite the bootloader
> > > and not be able to program the board. my test program puts the
> computer
> > > to sleep and then on wake up resets PLL or not, sets uart and then
> goes
> > > into a loop and contsantly prints out a string. At 60mhz everythng
> works
> > > and 12, not so much.
> > > > Stefan
> > > >
> > > >
> > > > --- In l...@yahoogroups.com
> ,
> > > "Michael Anton" wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: l...@yahoogroups.com
>
> > > > > > [mailto:l...@yahoogroups.com
>
> > > ]On Behalf
> > > > > > Of ssonderhoff
> > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > To: l...@yahoogroups.com
>
> > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > > > > not working
> > > > > > - Any Advice would be app.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hi,
> > > > > > The system boots up using a boot loader that allows the unit
> > > > > > to act as a thumb drive and access an SD card as well as load
> > > > > > firmware updates from the sd card. This code initializes the
> > > > > > system and sets the initial PLL and is difficult and
> > > > > > dangerous for me to change. the code used to set PLL in the
> > > > > > bootloader's Boot_up and system_init routines are shown below
> > > > > > shown below:
> > > > > >
> > > > >
> > > > > Couldn't you write a piece of standalone test code, without
> > > > > the bootloader, to test your routines when running at 12MHz?
> > > > >
> > > > > >
> > > > > > void boot_up(void)
> > > > > > {
> > > > > > //Initialize the MCU clock PLL
> > > > > > system_init();
> > > > > >
> > > > > > IODIR0 |= (1 << 31);
> > > > > > IOCLR0 |= (1 << 31); //Turn on USB LED
> > > > > >
> > > > > > //Init UART0 for debug
> > > > > > PINSEL0 |= 0x00000005; //enable uart0
> > > > > > U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
> > > > > > U0DLM = 0x00;
> > > > > > U0DLL = 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > > >
> > > > > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > > > > 60MHz, you will likely encounter USB problems, as obviously you
> > > > > cannot reach 48MHz with enough accuracy either.
> > > > >
> > > > > > U0LCR = 0x03; // DLAB = 0
> > > > > >
> > > > > > //Init rprintf
> > > > > > rprintf_devopen(putc_serial0);
> > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > >
> > > > > > //IOSET0 |= (1 << 31); //Turn off USB LED
> > > > > > }
> > > > > >
> > > > > > /**********************************************************
> > > > > > Initialize
> > > > > > **********************************************************/
> > > > > >
> > > > > > #define PLOCK 0x400
> > > > > >
> > > > > > void system_init(void)
> > > > > > {
> > > > > > // Setting Multiplier and Divider values
> > > > > > PLLCFG=0x24;
> > > > > > feed();
> > > > > >
> > > > > > // Enabling the PLL */
> > > > > > PLLCON=0x1;
> > > > > > feed();
> > > > > >
> > > > > > // Wait for the PLL to lock to set frequency
> > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > >
> > > > > > // Connect the PLL as the clock source
> > > > > > PLLCON=0x3;
> > > > > > feed();
> > > > > >
> > > > > > // Enabling MAM and setting number of clocks used for
> > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > //MAMTIM=0x3; //VCOM?
> > > > > > MAMCR=0x2;
> > > > > > MAMTIM=0x4; //Original
> > > > >
> > > > > It may not matter, but I usually change the MAM timing values
> > > > > prior to enabling the PLL. My rational is that if the values
> > > > > are set wrong when already running at 60MHz, how could I expect
> > > > > to reliably set them? Since there is no guarantee that I can read
> > > > > from flash if they are set for a lower clock rate.
> > > > >
> > > > > >
> > > > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > > > VPBDIV=0x1;
> > > > > > }
> > > > > >
> > > > > >
> > > > >
> > > > > Like I said before, your initialization looks fine, but I
> suspect the
> > > > > problem you are having might be elsewhere. So it would be useful to
> > > > > see the rest of your serial port code. Perhaps there is some timing
> > > > > issue that occurs when you run 5 times slower.
> > > > >
> > > > > When I developed my UART code, I had all sorts of problems that
> would
> > > > > occur at times, with seemingly no explanation, until I figured out
> > > > > the problem. It was very non-obvious at the time.
> > > > >
> > > > > So, if you can, break this down into a small piece of code that
> > > > > demonstrates the problem, I'll take a look at it.
> > > > >
> > > > > Mike
> > > > >
> > > > >
> > > > >
> > > > > > --- In l...@yahoogroups.com
>
> > > , "Michael Anton" wrote:
> > > > > > >
> > > > > > > Perhaps you could post the balance of your UART code. The
> > > > > > initialization
> > > > > > > looks fine to me.
> > > > > > >
> > > > > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > > > > Just to see if
> > > > > > > it is the changing
> > > > > > > between the clock speeds that has something to do with the
> > > > > > behaviour you are
> > > > > > > seeing.
> > > > > > >
> > > > > > > Mike
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: l...@yahoogroups.com
>
> > > > > > [mailto:l...@yahoogroups.com
>
> > > ]On Behalf Of
> > > > > > > ssonderhoff
> > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > To: l...@yahoogroups.com
>
> > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > > pclk - not working -
> > > > > > > Any Advice would be app.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > I will be appreciative for any insights, this is starting
> > > > > > to get quite
> > > > > > > frustrating.
> > > > > > >
> > > > > > > This is the code used to set the PLL to 60mhz. I modified
> > > > > > it to not set
> > > > > > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > > > > > going to this
> > > > > > > code all together. all gave the same result. As i mentioned
> > > earlier,
> > > > > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > > > > not worked with or
> > > > > > > without setting PLL. UART settings are in the previous message
> > > > > > >
> > > > > > > Thanks again,
> > > > > > > Stefan
> > > > > > >
> > > > > > > void PLL_init(int speed)
> > > > > > > {
> > > > > > >
> > > > > > > if(speed==fast){PLLCFG=0x24;} // Setting
> > > > > > Multiplier(5) and Divider(4)
> > > > > > > so 5xosc (12mhz) = 60 mhz
> > > > > > > else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60
> > > > > > >
> > > > > > > feed();
> > > > > > >
> > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > feed();
> > > > > > >
> > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to set
> > > > > > > frequency
> > > > > > >
> > > > > > > PLLCON=0x3;// Connect the PLL as the clock source
> > > > > > > feed();
> > > > > > > }
> > > > > > > --- In l...@yahoogroups.com
>
> > > , "ssonderhoff"
> > > > > > wrote:
> > > > > > > >
> > > > > > > > I removed the setting the PLL - after wake up I do not
> set PLL -
> > > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > > >
> > > > > > > > 0£7*6@î0£7*6@®0£w*4@®0£w*4.
> > > > > > > >
> > > > > > > > the light on the serial connection is blinking and the
> > > > > > junk is being
> > > > > > > output at a regular interval. these are the settings used
> > > > > > to set the baud
> > > > > > > rate to 9600 - They seem correct to me
> > > > > > > >
> > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > U0DLL = 0x4E; //lsb = 78
> > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> > > > > > > > //VICIntEnClr = 0x00000040;
> > > > > > > > U0IER = 0x00;
> > > > > > > >
> > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --- In l...@yahoogroups.com
>
> > > , Sutton Mehaffey sutton@ wrote:
> > > > > > > > >
> > > > > > > > > I don't turn PLL on when I use PCLK=CCLK. Mine works
> > > > > > fine. Try it and
> > > > > > > > > see if it fixes your problem. I think you only need
> > > > > > PLL on if you need
> > > > > > > > > more speed than PCLK.
> > > > > > > > >
> > > > > > > > > ssonderhoff wrote:
> > > > > > > > > >
> > > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > > the I have a
> > > > > > > blinking
> > > > > > > > > > light that confirms that this is the case, along
> > > > > > with a decrease in
> > > > > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > > > > thought that you
> > > > > > > > > > had to specify the M and P values as well as select
> > > > > > the external
> > > > > > > > > > oscillator. Could this be screwing things up? How
> > > > > > does one avoid
> > > > > > > using
> > > > > > > > > > the PLL? on waking up from sleep mode, do you bother
> setting
> > > > > > > anything,
> > > > > > > > > > or should you actively disable the PLL by setting
> > > > > > PLLC and PLLE to
> > > > > > > 0?
> > > > > > > > > > I assume that Pclk would then = cclk.
> > > > > > > > > >
> > > > > > > > > > Thanks again for the advice
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > > ,
> > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > >
> > > > > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > > > > need to activate
> > > > > > > PLL0,
> > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > > PLLCFG and UART)
> > > > > > > settings
> > > > > > > > > > > > seem to be correct - Please let me know if you
> > > > > > can see some
> > > > > > > > > > mistake - Is
> > > > > > > > > > > > there anything else that could affect UART0
> > > > > > after a cclk change.
> > > > > > > The
> > > > > > > > > > > > port is active, but the output is garbage. Any
> > > > > > thoughts would be
> > > > > > > > > > welcome.
> > > > > > > > > > > >
> > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > ,
> > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > > > > of 12 mhz to
> > > > > > > reduce
> > > > > > > > > > > > power usage. This is working, the power
> > > > > > consumption is down and
> > > > > > > a
> > > > > > > > > > light
> > > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > > reset the Uart0
> > > > > > > > > > parameters
> > > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > > >
> > > > > > > > > > > > > the PLL_int(code below) sets processor to
> 12mhz(slow).
> > > > > > > > > > > > >
> > > > > > > > > > > > > At 60mhz Everything is working fine fine and
> > > > > > I can read the
> > > > > > > output
> > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > >
> > > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > > > have tried setting
> > > > > > > to
> > > > > > > > > > > > different baud rates from low to high with the
> > > > > > same result.
> > > > > > > > > > > > >
> > > > > > > > > > > > > The Uart settings were determined using the
> > > > > > NXP lpc2000
> > > > > > > calculator
> > > > > > > > > > > > >
> > > > > > > > > > > > > I believe that I have faithfully followed the
> > > > > > data sheet. Can
> > > > > > > > > > anyone
> > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > Stefan
> > > > > > > > > > > > >
> > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > > > > {
> > > > > > > > > > > > >
> > > > > > > > > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting
> > > > > > Multiplier(5) and
> > > > > > > > > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > > > > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting
> > > > > > Multiplier(1) and
> > > > > > > > > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > > > > > > > > >
> > > > > > > > > > > > > feed();
> > > > > > > > > > > > >
> > > > > > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > > > > > feed();
> > > > > > > > > > > > >
> > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > > PLL to lock to set
> > > > > > > > > > frequency
> > > > > > > > > > > > >
> > > > > > > > > > > > > PLLCON=0x3;/ / Connect the PLL as the clock source
> > > > > > > > > > > > > feed();
> > > > > > > > > > > > >
> > > > > > > > > > > > > }
> > > > > > > > > > > > > //********** ********* ********* *********
> > > > > > ********* *********
> > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > > {
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > if(speed==fast)
> > > > > > > > > > > > > {
> > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > bit, DLAB = 1
> > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > }
> > > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > > {
> > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > bit, DLAB = 1
> > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > > > > > > > > U0FDR = 0xC1; //fract divider divaddval(3: 0) = 1 &
> > > > > > > mulval(7:4) = 12
> > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > U0LCR = 0x03;
> > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > }
> > > > > > > > > > > > >
> > > > > > > > > > > > > }
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > Sutton Mehaffey
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------------
> > > > > >
> > > > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 14:45:52 2010

Going to sleep should disable PLL since you need to reset the PLL after wak=
ing.=20
Also, disabling the PLL after wake up if it was put to sleep at the higher =
cclk also did not resolve the Uart0 problem. It seems as though you need to=
wake up the processor and set to the ?same? frequency that it was prior to=
going to sleep, maybe this has something to do with how I put it to sleep?=
. I have not tried setting the PLL to the fast cclk on wakeup and then chan=
ging it to the lower
speed. I will try this evening.
Stefan=20

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> I don't think that interrupt resets the PLL does it? You might need to=
=20
> reset it to OFF manually.
>=20
>=20
>=20
> ssonderhoff wrote:
> >=20=20
> >=20
> > I am using EINT3 (non vectored).
> >=20
> > Once cclk was changed to 12 mhz before going to sleep, the uart0 worked=
=20
> > fine before and after sleep. I have changed the baud rate up to 115200=
=20
> > and it still is working fine.
> >=20
> > --- In l...@yahoogroups.com ,=20
> > Sutton Mehaffey wrote:
> > >
> > > How are you waking the system back up? Pressing reset?
> > >
> > >
> > >
> > > ssonderhoff wrote:
> > > >
> > > >
> > > > Though I am not sure why. It turns out that if you shut off the PL=
L=20
> > and
> > > > change UART) settings before you put the system to sleep, then the
> > > > output is the desired text. If you go to sleep and then run the
> > > > identical code the output is the garbled nonsense I was getting. A=
ny
> > > > Ideas why this might be the case?
> > > > Thanks All,
> > > > Stefan
> > > >
> > > > --- In l...@yahoogroups.com =
=20
> > ,
> > > > "ssonderhoff" wrote:
> > > > >
> > > > >
> > > > > The board comes with the bootloader loaded and I have loaded all=
my
> > > > firmware using the bootlader. I would hate to overwrite the bootlo=
ader
> > > > and not be able to program the board. my test program puts the=20
> > computer
> > > > to sleep and then on wake up resets PLL or not, sets uart and then=
=20
> > goes
> > > > into a loop and contsantly prints out a string. At 60mhz everythng=
=20
> > works
> > > > and 12, not so much.
> > > > > Stefan
> > > > >
> > > > >
> > > > > --- In l...@yahoogroups.com >=20
> > ,
> > > > "Michael Anton" wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: l...@yahoogroups.com=20
> >
> > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > > ]On Behalf
> > > > > > > Of ssonderhoff
> > > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > > To: l...@yahoogroups.com=20
> >
> > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > > > > > not working
> > > > > > > - Any Advice would be app.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Hi,
> > > > > > > The system boots up using a boot loader that allows the unit
> > > > > > > to act as a thumb drive and access an SD card as well as loa=
d
> > > > > > > firmware updates from the sd card. This code initializes the
> > > > > > > system and sets the initial PLL and is difficult and
> > > > > > > dangerous for me to change. the code used to set PLL in the
> > > > > > > bootloader's Boot_up and system_init routines are shown belo=
w
> > > > > > > shown below:
> > > > > > >
> > > > > >
> > > > > > Couldn't you write a piece of standalone test code, without
> > > > > > the bootloader, to test your routines when running at 12MHz?
> > > > > >
> > > > > > >
> > > > > > > void boot_up(void)
> > > > > > > {
> > > > > > > //Initialize the MCU clock PLL
> > > > > > > system_init();
> > > > > > >
> > > > > > > IODIR0 |=3D (1 << 31);
> > > > > > > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> > > > > > >
> > > > > > > //Init UART0 for debug
> > > > > > > PINSEL0 |=3D 0x00000005; //enable uart0
> > > > > > > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =3D 1
> > > > > > > U0DLM =3D 0x00;
> > > > > > > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > > > >
> > > > > > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > > > > > 60MHz, you will likely encounter USB problems, as obviously yo=
u
> > > > > > cannot reach 48MHz with enough accuracy either.
> > > > > >
> > > > > > > U0LCR =3D 0x03; // DLAB =3D 0
> > > > > > >
> > > > > > > //Init rprintf
> > > > > > > rprintf_devopen(putc_serial0);
> > > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > > >
> > > > > > > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > > > > > > }
> > > > > > >
> > > > > > > /**********************************************************
> > > > > > > Initialize
> > > > > > > **********************************************************/
> > > > > > >
> > > > > > > #define PLOCK 0x400
> > > > > > >
> > > > > > > void system_init(void)
> > > > > > > {
> > > > > > > // Setting Multiplier and Divider values
> > > > > > > PLLCFG=3D0x24;
> > > > > > > feed();
> > > > > > >
> > > > > > > // Enabling the PLL */
> > > > > > > PLLCON=3D0x1;
> > > > > > > feed();
> > > > > > >
> > > > > > > // Wait for the PLL to lock to set frequency
> > > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > > >
> > > > > > > // Connect the PLL as the clock source
> > > > > > > PLLCON=3D0x3;
> > > > > > > feed();
> > > > > > >
> > > > > > > // Enabling MAM and setting number of clocks used for
> > > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > > //MAMTIM=3D0x3; //VCOM?
> > > > > > > MAMCR=3D0x2;
> > > > > > > MAMTIM=3D0x4; //Original
> > > > > >
> > > > > > It may not matter, but I usually change the MAM timing values
> > > > > > prior to enabling the PLL. My rational is that if the values
> > > > > > are set wrong when already running at 60MHz, how could I expec=
t
> > > > > > to reliably set them? Since there is no guarantee that I can r=
ead
> > > > > > from flash if they are set for a lower clock rate.
> > > > > >
> > > > > > >
> > > > > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > > > > VPBDIV=3D0x1;
> > > > > > > }
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > Like I said before, your initialization looks fine, but I=20
> > suspect the
> > > > > > problem you are having might be elsewhere. So it would be usef=
ul to
> > > > > > see the rest of your serial port code. Perhaps there is some t=
iming
> > > > > > issue that occurs when you run 5 times slower.
> > > > > >
> > > > > > When I developed my UART code, I had all sorts of problems tha=
t=20
> > would
> > > > > > occur at times, with seemingly no explanation, until I figured=
out
> > > > > > the problem. It was very non-obvious at the time.
> > > > > >
> > > > > > So, if you can, break this down into a small piece of code tha=
t
> > > > > > demonstrates the problem, I'll take a look at it.
> > > > > >
> > > > > > Mike
> > > > > >
> > > > > >
> > > > > >
> > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > , "Michael Anton" wrot=
e:
> > > > > > > >
> > > > > > > > Perhaps you could post the balance of your UART code. The
> > > > > > > initialization
> > > > > > > > looks fine to me.
> > > > > > > >
> > > > > > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > > > > > Just to see if
> > > > > > > > it is the changing
> > > > > > > > between the clock speeds that has something to do with the
> > > > > > > behaviour you are
> > > > > > > > seeing.
> > > > > > > >
> > > > > > > > Mike
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: l...@yahoogroups.com=20
> >
> > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > > ]On Behalf Of
> > > > > > > > ssonderhoff
> > > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > > To: l...@yahoogroups.com=20
> >
> > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > > > pclk - not working -
> > > > > > > > Any Advice would be app.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > I will be appreciative for any insights, this is starting
> > > > > > > to get quite
> > > > > > > > frustrating.
> > > > > > > >
> > > > > > > > This is the code used to set the PLL to 60mhz. I modified
> > > > > > > it to not set
> > > > > > > > the PLL in slow mode (12mhz) on wake up and then eliminate=
d
> > > > > > > going to this
> > > > > > > > code all together. all gave the same result. As i mentione=
d
> > > > earlier,
> > > > > > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > > > > > not worked with or
> > > > > > > > without setting PLL. UART settings are in the previous mes=
sage
> > > > > > > >
> > > > > > > > Thanks again,
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > > void PLL_init(int speed)
> > > > > > > > {
> > > > > > > >
> > > > > > > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > > > > > > Multiplier(5) and Divider(4)
> > > > > > > > so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=3D0x6=
0
> > > > > > > >
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock to =
set
> > > > > > > > frequency
> > > > > > > >
> > > > > > > > PLLCON=3D0x3;// Connect the PLL as the clock source
> > > > > > > > feed();
> > > > > > > > }
> > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > , "ssonderhoff"
> > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > I removed the setting the PLL - after wake up I do not=20
> > set PLL -
> > > > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > > > >
> > > > > > > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=A3w=
*4.
> > > > > > > > >
> > > > > > > > > the light on the serial connection is blinking and the
> > > > > > > junk is being
> > > > > > > > output at a regular interval. these are the settings used
> > > > > > > to set the baud
> > > > > > > > rate to 9600 - They seem correct to me
> > > > > > > > >
> > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DLAB =
=3D 1
> > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03;
> > > > > > > > > //VICIntEnClr =3D 0x00000040;
> > > > > > > > > U0IER =3D 0x00;
> > > > > > > > >
> > > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > > Stefan
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > , Sutton Mehaffey sutton@ wrote:
> > > > > > > > > >
> > > > > > > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine works
> > > > > > > fine. Try it and
> > > > > > > > > > see if it fixes your problem. I think you only need
> > > > > > > PLL on if you need
> > > > > > > > > > more speed than PCLK.
> > > > > > > > > >
> > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > >
> > > > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > > > the I have a
> > > > > > > > blinking
> > > > > > > > > > > light that confirms that this is the case, along
> > > > > > > with a decrease in
> > > > > > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > > > > > thought that you
> > > > > > > > > > > had to specify the M and P values as well as select
> > > > > > > the external
> > > > > > > > > > > oscillator. Could this be screwing things up? How
> > > > > > > does one avoid
> > > > > > > > using
> > > > > > > > > > > the PLL? on waking up from sleep mode, do you bother=
=20
> > setting
> > > > > > > > anything,
> > > > > > > > > > > or should you actively disable the PLL by setting
> > > > > > > PLLC and PLLE to
> > > > > > > > 0?
> > > > > > > > > > > I assume that Pclk would then =3D cclk.
> > > > > > > > > > >
> > > > > > > > > > > Thanks again for the advice
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > > > ,
> > > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > > > > > need to activate
> > > > > > > > PLL0,
> > > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > > > PLLCFG and UART)
> > > > > > > > settings
> > > > > > > > > > > > > seem to be correct - Please let me know if you
> > > > > > > can see some
> > > > > > > > > > > mistake - Is
> > > > > > > > > > > > > there anything else that could affect UART0
> > > > > > > after a cclk change.
> > > > > > > > The
> > > > > > > > > > > > > port is active, but the output is garbage. Any
> > > > > > > thoughts would be
> > > > > > > > > > > welcome.
> > > > > > > > > > > > >
> > > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > > ,
> > > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > > > > > of 12 mhz to
> > > > > > > > reduce
> > > > > > > > > > > > > power usage. This is working, the power
> > > > > > > consumption is down and
> > > > > > > > a
> > > > > > > > > > > light
> > > > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > > > reset the Uart0
> > > > > > > > > > > parameters
> > > > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > the PLL_int(code below) sets processor to=20
> > 12mhz(slow).
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > At 60mhz Everything is working fine fine and
> > > > > > > I can read the
> > > > > > > > output
> > > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > > > > have tried setting
> > > > > > > > to
> > > > > > > > > > > > > different baud rates from low to high with the
> > > > > > > same result.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > The Uart settings were determined using the
> > > > > > > NXP lpc2000
> > > > > > > > calculator
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I believe that I have faithfully followed the
> > > > > > > data sheet. Can
> > > > > > > > > > > anyone
> > > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > Stefan
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > > > > > {
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // Setti=
ng
> > > > > > > Multiplier(5) and
> > > > > > > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Setting
> > > > > > > Multiplier(1) and
> > > > > > > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > > > PLL to lock to set
> > > > > > > > > > > frequency
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the clock =
source
> > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > > //********** ********* ********* *********
> > > > > > > ********* *********
> > > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > > > {
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > > > > > > {
> > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > > > {
> > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop
> > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(3: 0=
) =3D 1 &
> > > > > > > > mulval(7:4) =3D 12
> > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > }
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > > Sutton Mehaffey
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ------------------------------------
> > > > > > >
> > > > > > >

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - Sutton Mehaffey - Feb 9 15:11:20 2010

I just tried it. I had PCLK = CCLK = 12mhz (PLL off). I set it to
18mhz before sleep mode (PLL0CON = 1, and PLL0CFG set to some value).
It was still 18mhz after EINT3 wake up, with the same PLL0 values. So,
waking up after going to sleep mode does not reset PLL values. An
actual reset (software or hardware) probably does.

ssonderhoff wrote:
>
>
> Going to sleep should disable PLL since you need to reset the PLL after
> waking.
> Also, disabling the PLL after wake up if it was put to sleep at the
> higher cclk also did not resolve the Uart0 problem. It seems as though
> you need to wake up the processor and set to the ?same? frequency that
> it was prior to going to sleep, maybe this has something to do with how
> I put it to sleep?. I have not tried setting the PLL to the fast cclk on
> wakeup and then changing it to the lower
> speed. I will try this evening.
> Stefan
>
> --- In l...@yahoogroups.com ,
> Sutton Mehaffey wrote:
> >
> > I don't think that interrupt resets the PLL does it? You might need to
> > reset it to OFF manually.
> >
> >
> >
> > ssonderhoff wrote:
> > >
> > >
> > > I am using EINT3 (non vectored).
> > >
> > > Once cclk was changed to 12 mhz before going to sleep, the uart0
> worked
> > > fine before and after sleep. I have changed the baud rate up to 115200
> > > and it still is working fine.
> > >
> > > --- In l...@yahoogroups.com
> ,
> > > Sutton Mehaffey wrote:
> > > >
> > > > How are you waking the system back up? Pressing reset?
> > > >
> > > >
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > >
> > > > > Though I am not sure why. It turns out that if you shut off the
> PLL
> > > and
> > > > > change UART) settings before you put the system to sleep, then the
> > > > > output is the desired text. If you go to sleep and then run the
> > > > > identical code the output is the garbled nonsense I was
> getting. Any
> > > > > Ideas why this might be the case?
> > > > > Thanks All,
> > > > > Stefan
> > > > >
> > > > > --- In l...@yahoogroups.com
>
> > > ,
> > > > > "ssonderhoff" wrote:
> > > > > >
> > > > > >
> > > > > > The board comes with the bootloader loaded and I have loaded
> all my
> > > > > firmware using the bootlader. I would hate to overwrite the
> bootloader
> > > > > and not be able to program the board. my test program puts the
> > > computer
> > > > > to sleep and then on wake up resets PLL or not, sets uart and then
> > > goes
> > > > > into a loop and contsantly prints out a string. At 60mhz everythng
> > > works
> > > > > and 12, not so much.
> > > > > > Stefan
> > > > > >
> > > > > >
> > > > > > --- In l...@yahoogroups.com
>
> > > ,
> > > > > "Michael Anton" wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: l...@yahoogroups.com
>
> > >
> > > > > > > > [mailto:l...@yahoogroups.com
>
> > >
> > > > > ]On Behalf
> > > > > > > > Of ssonderhoff
> > > > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > > > To: l...@yahoogroups.com
>
> > >
> > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pclk -
> > > > > > > > not working
> > > > > > > > - Any Advice would be app.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > > The system boots up using a boot loader that allows the unit
> > > > > > > > to act as a thumb drive and access an SD card as well as load
> > > > > > > > firmware updates from the sd card. This code initializes the
> > > > > > > > system and sets the initial PLL and is difficult and
> > > > > > > > dangerous for me to change. the code used to set PLL in the
> > > > > > > > bootloader's Boot_up and system_init routines are shown below
> > > > > > > > shown below:
> > > > > > > >
> > > > > > >
> > > > > > > Couldn't you write a piece of standalone test code, without
> > > > > > > the bootloader, to test your routines when running at 12MHz?
> > > > > > >
> > > > > > > >
> > > > > > > > void boot_up(void)
> > > > > > > > {
> > > > > > > > //Initialize the MCU clock PLL
> > > > > > > > system_init();
> > > > > > > >
> > > > > > > > IODIR0 |= (1 << 31);
> > > > > > > > IOCLR0 |= (1 << 31); //Turn on USB LED
> > > > > > > >
> > > > > > > > //Init UART0 for debug
> > > > > > > > PINSEL0 |= 0x00000005; //enable uart0
> > > > > > > > U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
> > > > > > > > U0DLM = 0x00;
> > > > > > > > U0DLL = 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > > > > >
> > > > > > > So are you using a 58982400Hz clock, or 60MHz? If this is not
> > > > > > > 60MHz, you will likely encounter USB problems, as obviously you
> > > > > > > cannot reach 48MHz with enough accuracy either.
> > > > > > >
> > > > > > > > U0LCR = 0x03; // DLAB = 0
> > > > > > > >
> > > > > > > > //Init rprintf
> > > > > > > > rprintf_devopen(putc_serial0);
> > > > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > > > >
> > > > > > > > //IOSET0 |= (1 << 31); //Turn off USB LED
> > > > > > > > }
> > > > > > > >
> > > > > > > > /**********************************************************
> > > > > > > > Initialize
> > > > > > > > **********************************************************/
> > > > > > > >
> > > > > > > > #define PLOCK 0x400
> > > > > > > >
> > > > > > > > void system_init(void)
> > > > > > > > {
> > > > > > > > // Setting Multiplier and Divider values
> > > > > > > > PLLCFG=0x24;
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > // Enabling the PLL */
> > > > > > > > PLLCON=0x1;
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > // Wait for the PLL to lock to set frequency
> > > > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > > > >
> > > > > > > > // Connect the PLL as the clock source
> > > > > > > > PLLCON=0x3;
> > > > > > > > feed();
> > > > > > > >
> > > > > > > > // Enabling MAM and setting number of clocks used for
> > > > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > > > //MAMTIM=0x3; //VCOM?
> > > > > > > > MAMCR=0x2;
> > > > > > > > MAMTIM=0x4; //Original
> > > > > > >
> > > > > > > It may not matter, but I usually change the MAM timing values
> > > > > > > prior to enabling the PLL. My rational is that if the values
> > > > > > > are set wrong when already running at 60MHz, how could I expect
> > > > > > > to reliably set them? Since there is no guarantee that I
> can read
> > > > > > > from flash if they are set for a lower clock rate.
> > > > > > >
> > > > > > > >
> > > > > > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > > > > > VPBDIV=0x1;
> > > > > > > > }
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > Like I said before, your initialization looks fine, but I
> > > suspect the
> > > > > > > problem you are having might be elsewhere. So it would be
> useful to
> > > > > > > see the rest of your serial port code. Perhaps there is
> some timing
> > > > > > > issue that occurs when you run 5 times slower.
> > > > > > >
> > > > > > > When I developed my UART code, I had all sorts of problems
> that
> > > would
> > > > > > > occur at times, with seemingly no explanation, until I
> figured out
> > > > > > > the problem. It was very non-obvious at the time.
> > > > > > >
> > > > > > > So, if you can, break this down into a small piece of code that
> > > > > > > demonstrates the problem, I'll take a look at it.
> > > > > > >
> > > > > > > Mike
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > , "Michael Anton"
> wrote:
> > > > > > > > >
> > > > > > > > > Perhaps you could post the balance of your UART code. The
> > > > > > > > initialization
> > > > > > > > > looks fine to me.
> > > > > > > > >
> > > > > > > > > Have you tried using only 12MHz, and not going into 60MHz?
> > > > > > > > Just to see if
> > > > > > > > > it is the changing
> > > > > > > > > between the clock speeds that has something to do with the
> > > > > > > > behaviour you are
> > > > > > > > > seeing.
> > > > > > > > >
> > > > > > > > > Mike
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: l...@yahoogroups.com
>
> > >
> > > > > > > > [mailto:l...@yahoogroups.com
>
> > >
> > > > > ]On Behalf Of
> > > > > > > > > ssonderhoff
> > > > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > > > To: l...@yahoogroups.com
>
> > >
> > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > > > > pclk - not working -
> > > > > > > > > Any Advice would be app.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I will be appreciative for any insights, this is starting
> > > > > > > > to get quite
> > > > > > > > > frustrating.
> > > > > > > > >
> > > > > > > > > This is the code used to set the PLL to 60mhz. I modified
> > > > > > > > it to not set
> > > > > > > > > the PLL in slow mode (12mhz) on wake up and then eliminated
> > > > > > > > going to this
> > > > > > > > > code all together. all gave the same result. As i mentioned
> > > > > earlier,
> > > > > > > > > everything works fine at 60mhz, where as at 12 mhz it has
> > > > > > > > not worked with or
> > > > > > > > > without setting PLL. UART settings are in the previous
> message
> > > > > > > > >
> > > > > > > > > Thanks again,
> > > > > > > > > Stefan
> > > > > > > > >
> > > > > > > > > void PLL_init(int speed)
> > > > > > > > > {
> > > > > > > > >
> > > > > > > > > if(speed==fast){PLLCFG=0x24;} // Setting
> > > > > > > > Multiplier(5) and Divider(4)
> > > > > > > > > so 5xosc (12mhz) = 60 mhz
> > > > > > > > > else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60
> > > > > > > > >
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock
> to set
> > > > > > > > > frequency
> > > > > > > > >
> > > > > > > > > PLLCON=0x3;// Connect the PLL as the clock source
> > > > > > > > > feed();
> > > > > > > > > }
> > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > , "ssonderhoff"
> > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > I removed the setting the PLL - after wake up I do not
> > > set PLL -
> > > > > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > > > > >
> > > > > > > > > > 0£7*6@î0£7*6@®0£w*4@®0£w*4.
> > > > > > > > > >
> > > > > > > > > > the light on the serial connection is blinking and the
> > > > > > > > junk is being
> > > > > > > > > output at a regular interval. these are the settings used
> > > > > > > > to set the baud
> > > > > > > > > rate to 9600 - They seem correct to me
> > > > > > > > > >
> > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
> > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > U0DLL = 0x4E; //lsb = 78
> > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> > > > > > > > > > //VICIntEnClr = 0x00000040;
> > > > > > > > > > U0IER = 0x00;
> > > > > > > > > >
> > > > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > > > Stefan
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > , Sutton Mehaffey sutton@ wrote:
> > > > > > > > > > >
> > > > > > > > > > > I don't turn PLL on when I use PCLK=CCLK. Mine works
> > > > > > > > fine. Try it and
> > > > > > > > > > > see if it fixes your problem. I think you only need
> > > > > > > > PLL on if you need
> > > > > > > > > > > more speed than PCLK.
> > > > > > > > > > >
> > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > > > > the I have a
> > > > > > > > > blinking
> > > > > > > > > > > > light that confirms that this is the case, along
> > > > > > > > with a decrease in
> > > > > > > > > > > > power draw. I am setting the multiplier(M) to 1. I
> > > > > > > > thought that you
> > > > > > > > > > > > had to specify the M and P values as well as select
> > > > > > > > the external
> > > > > > > > > > > > oscillator. Could this be screwing things up? How
> > > > > > > > does one avoid
> > > > > > > > > using
> > > > > > > > > > > > the PLL? on waking up from sleep mode, do you bother
> > > setting
> > > > > > > > > anything,
> > > > > > > > > > > > or should you actively disable the PLL by setting
> > > > > > > > PLLC and PLLE to
> > > > > > > > > 0?
> > > > > > > > > > > > I assume that Pclk would then = cclk.
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks again for the advice
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > > ,
> > > > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > What's your Fosc? If it is 12, I don't think you
> > > > > > > > need to activate
> > > > > > > > > PLL0,
> > > > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > > > > PLLCFG and UART)
> > > > > > > > > settings
> > > > > > > > > > > > > > seem to be correct - Please let me know if you
> > > > > > > > can see some
> > > > > > > > > > > > mistake - Is
> > > > > > > > > > > > > > there anything else that could affect UART0
> > > > > > > > after a cclk change.
> > > > > > > > > The
> > > > > > > > > > > > > > port is active, but the output is garbage. Any
> > > > > > > > thoughts would be
> > > > > > > > > > > > welcome.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > > > ,
> > > > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I am running the lpc2148 at a low clock speed
> > > > > > > > of 12 mhz to
> > > > > > > > > reduce
> > > > > > > > > > > > > > power usage. This is working, the power
> > > > > > > > consumption is down and
> > > > > > > > > a
> > > > > > > > > > > > light
> > > > > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > > > > reset the Uart0
> > > > > > > > > > > > parameters
> > > > > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > the PLL_int(code below) sets processor to
> > > 12mhz(slow).
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > At 60mhz Everything is working fine fine and
> > > > > > > > I can read the
> > > > > > > > > output
> > > > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > > > > > have tried setting
> > > > > > > > > to
> > > > > > > > > > > > > > different baud rates from low to high with the
> > > > > > > > same result.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > The Uart settings were determined using the
> > > > > > > > NXP lpc2000
> > > > > > > > > calculator
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I believe that I have faithfully followed the
> > > > > > > > data sheet. Can
> > > > > > > > > > > > anyone
> > > > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > > Stefan
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > > > void PLL_init(int speed) // sets clock speed
> > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting
> > > > > > > > Multiplier(5) and
> > > > > > > > > > > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > > > > > > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting
> > > > > > > > Multiplier(1) and
> > > > > > > > > > > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > > > > PLL to lock to set
> > > > > > > > > > > > frequency
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > PLLCON=0x3;/ / Connect the PLL as the clock
> source
> > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > //********** ********* ********* *********
> > > > > > > > ********* *********
> > > > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > if(speed==fast)
> > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > > > bit, DLAB = 1
> > > > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > > > bit, DLAB = 1
> > > > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > > > > > > > > > > U0FDR = 0xC1; //fract divider divaddval(3:
> 0) = 1 &
> > > > > > > > > mulval(7:4) = 12
> > > > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > > > U0LCR = 0x03;
> > > > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > --
> > > > > > > > > > > > > Sutton Mehaffey
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > ------------------------------------
> > > > > > > >
> > > > > > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 16:08:01 2010

According to the manual going to sleep disconnects the PLL which must then =
be reconnected in software, this will not happen automatically. in the abse=
nce of that, cclk =3D osc frequency. The PLL configuration is not reset, bu=
t when I went to sleep at 60mhz and then actively reset them to the 12mhz i=
mmediately after waking up the cclk was set lower ( I timed LED flashes tha=
t indicated that the processor speed was around 1/5 of the before sleep rat=
e) but Uart0 would only output garbage even after resetting the uart0 setti=
ngs. These same settings worked fine if the cclk and uart0 were changed be=
fore sleep

ie:=20
cclk 60mhz ->sleep-> set 12mhz and uart =3D uart outputs garbage
cclk 60mhz -> set 12mhz and uart -> sleep =3D uart output is fine

Thanks,
Stefan

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> I just tried it. I had PCLK =3D CCLK =3D 12mhz (PLL off). I set it to=20
> 18mhz before sleep mode (PLL0CON =3D 1, and PLL0CFG set to some value).=20
> It was still 18mhz after EINT3 wake up, with the same PLL0 values. So,=20
> waking up after going to sleep mode does not reset PLL values. An=20
> actual reset (software or hardware) probably does.
>=20
>=20
>=20
> ssonderhoff wrote:
> >=20=20
> >=20
> > Going to sleep should disable PLL since you need to reset the PLL after=
=20
> > waking.
> > Also, disabling the PLL after wake up if it was put to sleep at the=20
> > higher cclk also did not resolve the Uart0 problem. It seems as though=
=20
> > you need to wake up the processor and set to the ?same? frequency that=
=20
> > it was prior to going to sleep, maybe this has something to do with how=
=20
> > I put it to sleep?. I have not tried setting the PLL to the fast cclk o=
n=20
> > wakeup and then changing it to the lower
> > speed. I will try this evening.
> > Stefan
> >=20
> > --- In l...@yahoogroups.com ,=20
> > Sutton Mehaffey wrote:
> > >
> > > I don't think that interrupt resets the PLL does it? You might need =
to
> > > reset it to OFF manually.
> > >
> > >
> > >
> > > ssonderhoff wrote:
> > > >
> > > >
> > > > I am using EINT3 (non vectored).
> > > >
> > > > Once cclk was changed to 12 mhz before going to sleep, the uart0=20
> > worked
> > > > fine before and after sleep. I have changed the baud rate up to 11=
5200
> > > > and it still is working fine.
> > > >
> > > > --- In l...@yahoogroups.com =
=20
> > ,
> > > > Sutton Mehaffey wrote:
> > > > >
> > > > > How are you waking the system back up? Pressing reset?
> > > > >
> > > > >
> > > > >
> > > > > ssonderhoff wrote:
> > > > > >
> > > > > >
> > > > > > Though I am not sure why. It turns out that if you shut off th=
e=20
> > PLL
> > > > and
> > > > > > change UART) settings before you put the system to sleep, then=
the
> > > > > > output is the desired text. If you go to sleep and then run th=
e
> > > > > > identical code the output is the garbled nonsense I was=20
> > getting. Any
> > > > > > Ideas why this might be the case?
> > > > > > Thanks All,
> > > > > > Stefan
> > > > > >
> > > > > > --- In l...@yahoogroups.com=20
> >
> > > > ,
> > > > > > "ssonderhoff" wrote:
> > > > > > >
> > > > > > >
> > > > > > > The board comes with the bootloader loaded and I have loaded=
=20
> > all my
> > > > > > firmware using the bootlader. I would hate to overwrite the=20
> > bootloader
> > > > > > and not be able to program the board. my test program puts the
> > > > computer
> > > > > > to sleep and then on wake up resets PLL or not, sets uart and =
then
> > > > goes
> > > > > > into a loop and contsantly prints out a string. At 60mhz every=
thng
> > > > works
> > > > > > and 12, not so much.
> > > > > > > Stefan
> > > > > > >
> > > > > > >
> > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > ,
> > > > > > "Michael Anton" wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > >
> > > > > > ]On Behalf
> > > > > > > > > Of ssonderhoff
> > > > > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > > > > To: l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz pc=
lk -
> > > > > > > > > not working
> > > > > > > > > - Any Advice would be app.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > > The system boots up using a boot loader that allows the =
unit
> > > > > > > > > to act as a thumb drive and access an SD card as well as=
load
> > > > > > > > > firmware updates from the sd card. This code initializes=
the
> > > > > > > > > system and sets the initial PLL and is difficult and
> > > > > > > > > dangerous for me to change. the code used to set PLL in =
the
> > > > > > > > > bootloader's Boot_up and system_init routines are shown =
below
> > > > > > > > > shown below:
> > > > > > > > >
> > > > > > > >
> > > > > > > > Couldn't you write a piece of standalone test code, withou=
t
> > > > > > > > the bootloader, to test your routines when running at 12MH=
z?
> > > > > > > >
> > > > > > > > >
> > > > > > > > > void boot_up(void)
> > > > > > > > > {
> > > > > > > > > //Initialize the MCU clock PLL
> > > > > > > > > system_init();
> > > > > > > > >
> > > > > > > > > IODIR0 |=3D (1 << 31);
> > > > > > > > > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> > > > > > > > >
> > > > > > > > > //Init UART0 for debug
> > > > > > > > > PINSEL0 |=3D 0x00000005; //enable uart0
> > > > > > > > > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB =
=3D 1
> > > > > > > > > U0DLM =3D 0x00;
> > > > > > > > > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > > > > > >
> > > > > > > > So are you using a 58982400Hz clock, or 60MHz? If this is =
not
> > > > > > > > 60MHz, you will likely encounter USB problems, as obviousl=
y you
> > > > > > > > cannot reach 48MHz with enough accuracy either.
> > > > > > > >
> > > > > > > > > U0LCR =3D 0x03; // DLAB =3D 0
> > > > > > > > >
> > > > > > > > > //Init rprintf
> > > > > > > > > rprintf_devopen(putc_serial0);
> > > > > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > > > > >
> > > > > > > > > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > /*******************************************************=
***
> > > > > > > > > Initialize
> > > > > > > > > ********************************************************=
**/
> > > > > > > > >
> > > > > > > > > #define PLOCK 0x400
> > > > > > > > >
> > > > > > > > > void system_init(void)
> > > > > > > > > {
> > > > > > > > > // Setting Multiplier and Divider values
> > > > > > > > > PLLCFG=3D0x24;
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > // Enabling the PLL */
> > > > > > > > > PLLCON=3D0x1;
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > // Wait for the PLL to lock to set frequency
> > > > > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > > > > >
> > > > > > > > > // Connect the PLL as the clock source
> > > > > > > > > PLLCON=3D0x3;
> > > > > > > > > feed();
> > > > > > > > >
> > > > > > > > > // Enabling MAM and setting number of clocks used for
> > > > > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > > > > //MAMTIM=3D0x3; //VCOM?
> > > > > > > > > MAMCR=3D0x2;
> > > > > > > > > MAMTIM=3D0x4; //Original
> > > > > > > >
> > > > > > > > It may not matter, but I usually change the MAM timing val=
ues
> > > > > > > > prior to enabling the PLL. My rational is that if the valu=
es
> > > > > > > > are set wrong when already running at 60MHz, how could I e=
xpect
> > > > > > > > to reliably set them? Since there is no guarantee that I=20
> > can read
> > > > > > > > from flash if they are set for a lower clock rate.
> > > > > > > >
> > > > > > > > >
> > > > > > > > > // Setting peripheral Clock (pclk) to System Clock (cclk=
)
> > > > > > > > > VPBDIV=3D0x1;
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > Like I said before, your initialization looks fine, but I
> > > > suspect the
> > > > > > > > problem you are having might be elsewhere. So it would be=
=20
> > useful to
> > > > > > > > see the rest of your serial port code. Perhaps there is=20
> > some timing
> > > > > > > > issue that occurs when you run 5 times slower.
> > > > > > > >
> > > > > > > > When I developed my UART code, I had all sorts of problems=
=20
> > that
> > > > would
> > > > > > > > occur at times, with seemingly no explanation, until I=20
> > figured out
> > > > > > > > the problem. It was very non-obvious at the time.
> > > > > > > >
> > > > > > > > So, if you can, break this down into a small piece of code=
that
> > > > > > > > demonstrates the problem, I'll take a look at it.
> > > > > > > >
> > > > > > > > Mike
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > > , "Michael Anton" =
=20
> > wrote:
> > > > > > > > > >
> > > > > > > > > > Perhaps you could post the balance of your UART code. =
The
> > > > > > > > > initialization
> > > > > > > > > > looks fine to me.
> > > > > > > > > >
> > > > > > > > > > Have you tried using only 12MHz, and not going into 60=
MHz?
> > > > > > > > > Just to see if
> > > > > > > > > > it is the changing
> > > > > > > > > > between the clock speeds that has something to do with=
the
> > > > > > > > > behaviour you are
> > > > > > > > > > seeing.
> > > > > > > > > >
> > > > > > > > > > Mike
> > > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > >
> > > > > > ]On Behalf Of
> > > > > > > > > > ssonderhoff
> > > > > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > > > > To: l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > > > > > pclk - not working -
> > > > > > > > > > Any Advice would be app.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > I will be appreciative for any insights, this is start=
ing
> > > > > > > > > to get quite
> > > > > > > > > > frustrating.
> > > > > > > > > >
> > > > > > > > > > This is the code used to set the PLL to 60mhz. I modif=
ied
> > > > > > > > > it to not set
> > > > > > > > > > the PLL in slow mode (12mhz) on wake up and then elimi=
nated
> > > > > > > > > going to this
> > > > > > > > > > code all together. all gave the same result. As i ment=
ioned
> > > > > > earlier,
> > > > > > > > > > everything works fine at 60mhz, where as at 12 mhz it =
has
> > > > > > > > > not worked with or
> > > > > > > > > > without setting PLL. UART settings are in the previous=
=20
> > message
> > > > > > > > > >
> > > > > > > > > > Thanks again,
> > > > > > > > > > Stefan
> > > > > > > > > >
> > > > > > > > > > void PLL_init(int speed)
> > > > > > > > > > {
> > > > > > > > > >
> > > > > > > > > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > > > > > > > > Multiplier(5) and Divider(4)
> > > > > > > > > > so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLCFG=
=3D0x60
> > > > > > > > > >
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock=
=20
> > to set
> > > > > > > > > > frequency
> > > > > > > > > >
> > > > > > > > > > PLLCON=3D0x3;// Connect the PLL as the clock source
> > > > > > > > > > feed();
> > > > > > > > > > }
> > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > > , "ssonderhoff"
> > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > I removed the setting the PLL - after wake up I do n=
ot
> > > > set PLL -
> > > > > > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > > > > > >
> > > > > > > > > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=AE0=
=A3w*4.
> > > > > > > > > > >
> > > > > > > > > > > the light on the serial connection is blinking and t=
he
> > > > > > > > > junk is being
> > > > > > > > > > output at a regular interval. these are the settings u=
sed
> > > > > > > > > to set the baud
> > > > > > > > > > rate to 9600 - They seem correct to me
> > > > > > > > > > >
> > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit, DL=
AB =3D 1
> > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D x03=
;
> > > > > > > > > > > //VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > >
> > > > > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > > > > Stefan
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > > , Sutton Mehaffey sutton@ wr=
ote:
> > > > > > > > > > > >
> > > > > > > > > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mine w=
orks
> > > > > > > > > fine. Try it and
> > > > > > > > > > > > see if it fixes your problem. I think you only nee=
d
> > > > > > > > > PLL on if you need
> > > > > > > > > > > > more speed than PCLK.
> > > > > > > > > > > >
> > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > > > > > the I have a
> > > > > > > > > > blinking
> > > > > > > > > > > > > light that confirms that this is the case, along
> > > > > > > > > with a decrease in
> > > > > > > > > > > > > power draw. I am setting the multiplier(M) to 1.=
I
> > > > > > > > > thought that you
> > > > > > > > > > > > > had to specify the M and P values as well as sel=
ect
> > > > > > > > > the external
> > > > > > > > > > > > > oscillator. Could this be screwing things up? Ho=
w
> > > > > > > > > does one avoid
> > > > > > > > > > using
> > > > > > > > > > > > > the PLL? on waking up from sleep mode, do you bo=
ther
> > > > setting
> > > > > > > > > > anything,
> > > > > > > > > > > > > or should you actively disable the PLL by settin=
g
> > > > > > > > > PLLC and PLLE to
> > > > > > > > > > 0?
> > > > > > > > > > > > > I assume that Pclk would then =3D cclk.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thanks again for the advice
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > > ,
> > > > > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > What's your Fosc? If it is 12, I don't think y=
ou
> > > > > > > > > need to activate
> > > > > > > > > > PLL0,
> > > > > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > > > > > PLLCFG and UART)
> > > > > > > > > > settings
> > > > > > > > > > > > > > > seem to be correct - Please let me know if y=
ou
> > > > > > > > > can see some
> > > > > > > > > > > > > mistake - Is
> > > > > > > > > > > > > > > there anything else that could affect UART0
> > > > > > > > > after a cclk change.
> > > > > > > > > > The
> > > > > > > > > > > > > > > port is active, but the output is garbage. A=
ny
> > > > > > > > > thoughts would be
> > > > > > > > > > > > > welcome.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > > > > ,
> > > > > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I am running the lpc2148 at a low clock sp=
eed
> > > > > > > > > of 12 mhz to
> > > > > > > > > > reduce
> > > > > > > > > > > > > > > power usage. This is working, the power
> > > > > > > > > consumption is down and
> > > > > > > > > > a
> > > > > > > > > > > > > light
> > > > > > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > > > > > reset the Uart0
> > > > > > > > > > > > > parameters
> > > > > > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > the PLL_int(code below) sets processor to
> > > > 12mhz(slow).
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > At 60mhz Everything is working fine fine a=
nd
> > > > > > > > > I can read the
> > > > > > > > > > output
> > > > > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, =
I
> > > > > > > > > have tried setting
> > > > > > > > > > to
> > > > > > > > > > > > > > > different baud rates from low to high with t=
he
> > > > > > > > > same result.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > The Uart settings were determined using th=
e
> > > > > > > > > NXP lpc2000
> > > > > > > > > > calculator
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I believe that I have faithfully followed =
the
> > > > > > > > > data sheet. Can
> > > > > > > > > > > > > anyone
> > > > > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > > > Stefan
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > > > > void PLL_init(int speed) // sets clock spe=
ed
> > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } // S=
etting
> > > > > > > > > Multiplier(5) and
> > > > > > > > > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} //Set=
ting
> > > > > > > > > Multiplier(1) and
> > > > > > > > > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D cclk
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > > > > > PLL to lock to set
> > > > > > > > > > > > > frequency
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as the cl=
ock=20
> > source
> > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > //********** ********* ********* *********
> > > > > > > > > ********* *********
> > > > > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 st=
op
> > > > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > > > U0LCR =3D 0x03; // 8 bit character length
> > > > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 st=
op
> > > > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > > > > > > > > U0FDR =3D 0xC1; //fract divider divaddval(=
3:=20
> > 0) =3D 1 &
> > > > > > > > > > mulval(7:4) =3D 12
> > > > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > --
> > > > > > > > > > > > > > Sutton Mehaffey
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > ------------------------------------
> > > > > > > > >
> > > > > > > > >

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - Sutton Mehaffey - Feb 9 16:17:53 2010

I hear you and understand your issue. But, I put a breakpoint in my
code after wakeup and the values of PLL0 had not changed. I'm not using
any uarts, so I couldn't test any output. So, maybe even though the
PLL0 values don't change, maybe you still have to reinitialize it to get
it going. Don't have time to investigate, right now, however.

Sutton

ssonderhoff wrote:
>
>
> According to the manual going to sleep disconnects the PLL which must
> then be reconnected in software, this will not happen automatically. in
> the absence of that, cclk = osc frequency. The PLL configuration is not
> reset, but when I went to sleep at 60mhz and then actively reset them to
> the 12mhz immediately after waking up the cclk was set lower ( I timed
> LED flashes that indicated that the processor speed was around 1/5 of
> the before sleep rate) but Uart0 would only output garbage even after
> resetting the uart0 settings. These same settings worked fine if the
> cclk and uart0 were changed before sleep
>
> ie:
> cclk 60mhz ->sleep-> set 12mhz and uart = uart outputs garbage
> cclk 60mhz -> set 12mhz and uart -> sleep = uart output is fine
>
> Thanks,
> Stefan
>
> --- In l...@yahoogroups.com ,
> Sutton Mehaffey wrote:
> >
> > I just tried it. I had PCLK = CCLK = 12mhz (PLL off). I set it to
> > 18mhz before sleep mode (PLL0CON = 1, and PLL0CFG set to some value).
> > It was still 18mhz after EINT3 wake up, with the same PLL0 values. So,
> > waking up after going to sleep mode does not reset PLL values. An
> > actual reset (software or hardware) probably does.
> >
> >
> >
> > ssonderhoff wrote:
> > >
> > >
> > > Going to sleep should disable PLL since you need to reset the PLL
> after
> > > waking.
> > > Also, disabling the PLL after wake up if it was put to sleep at the
> > > higher cclk also did not resolve the Uart0 problem. It seems as though
> > > you need to wake up the processor and set to the ?same? frequency that
> > > it was prior to going to sleep, maybe this has something to do with
> how
> > > I put it to sleep?. I have not tried setting the PLL to the fast
> cclk on
> > > wakeup and then changing it to the lower
> > > speed. I will try this evening.
> > > Stefan
> > >
> > > --- In l...@yahoogroups.com
> ,
> > > Sutton Mehaffey wrote:
> > > >
> > > > I don't think that interrupt resets the PLL does it? You might
> need to
> > > > reset it to OFF manually.
> > > >
> > > >
> > > >
> > > > ssonderhoff wrote:
> > > > >
> > > > >
> > > > > I am using EINT3 (non vectored).
> > > > >
> > > > > Once cclk was changed to 12 mhz before going to sleep, the uart0
> > > worked
> > > > > fine before and after sleep. I have changed the baud rate up to
> 115200
> > > > > and it still is working fine.
> > > > >
> > > > > --- In l...@yahoogroups.com
>
> > > ,
> > > > > Sutton Mehaffey wrote:
> > > > > >
> > > > > > How are you waking the system back up? Pressing reset?
> > > > > >
> > > > > >
> > > > > >
> > > > > > ssonderhoff wrote:
> > > > > > >
> > > > > > >
> > > > > > > Though I am not sure why. It turns out that if you shut off
> the
> > > PLL
> > > > > and
> > > > > > > change UART) settings before you put the system to sleep,
> then the
> > > > > > > output is the desired text. If you go to sleep and then run the
> > > > > > > identical code the output is the garbled nonsense I was
> > > getting. Any
> > > > > > > Ideas why this might be the case?
> > > > > > > Thanks All,
> > > > > > > Stefan
> > > > > > >
> > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > ,
> > > > > > > "ssonderhoff" wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > > The board comes with the bootloader loaded and I have loaded
> > > all my
> > > > > > > firmware using the bootlader. I would hate to overwrite the
> > > bootloader
> > > > > > > and not be able to program the board. my test program puts the
> > > > > computer
> > > > > > > to sleep and then on wake up resets PLL or not, sets uart
> and then
> > > > > goes
> > > > > > > into a loop and contsantly prints out a string. At 60mhz
> everythng
> > > > > works
> > > > > > > and 12, not so much.
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > >
> > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > > ,
> > > > > > > "Michael Anton" wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: l...@yahoogroups.com
>
> > >
> > > > >
>
> > > > > > > > > > [mailto:l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > ]On Behalf
> > > > > > > > > > Of ssonderhoff
> > > > > > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > > > > > To: l...@yahoogroups.com
>
> > >
> > > > >
>
> > > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> pclk -
> > > > > > > > > > not working
> > > > > > > > > > - Any Advice would be app.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Hi,
> > > > > > > > > > The system boots up using a boot loader that allows
> the unit
> > > > > > > > > > to act as a thumb drive and access an SD card as well
> as load
> > > > > > > > > > firmware updates from the sd card. This code
> initializes the
> > > > > > > > > > system and sets the initial PLL and is difficult and
> > > > > > > > > > dangerous for me to change. the code used to set PLL
> in the
> > > > > > > > > > bootloader's Boot_up and system_init routines are
> shown below
> > > > > > > > > > shown below:
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Couldn't you write a piece of standalone test code, without
> > > > > > > > > the bootloader, to test your routines when running at
> 12MHz?
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > void boot_up(void)
> > > > > > > > > > {
> > > > > > > > > > //Initialize the MCU clock PLL
> > > > > > > > > > system_init();
> > > > > > > > > >
> > > > > > > > > > IODIR0 |= (1 << 31);
> > > > > > > > > > IOCLR0 |= (1 << 31); //Turn on USB LED
> > > > > > > > > >
> > > > > > > > > > //Init UART0 for debug
> > > > > > > > > > PINSEL0 |= 0x00000005; //enable uart0
> > > > > > > > > > U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
> > > > > > > > > > U0DLM = 0x00;
> > > > > > > > > > U0DLL = 0x20; // 115200 Baud Rate @ 58982400 VPB Clock
> > > > > > > > >
> > > > > > > > > So are you using a 58982400Hz clock, or 60MHz? If this
> is not
> > > > > > > > > 60MHz, you will likely encounter USB problems, as
> obviously you
> > > > > > > > > cannot reach 48MHz with enough accuracy either.
> > > > > > > > >
> > > > > > > > > > U0LCR = 0x03; // DLAB = 0
> > > > > > > > > >
> > > > > > > > > > //Init rprintf
> > > > > > > > > > rprintf_devopen(putc_serial0);
> > > > > > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > > > > > >
> > > > > > > > > > //IOSET0 |= (1 << 31); //Turn off USB LED
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > >
> /**********************************************************
> > > > > > > > > > Initialize
> > > > > > > > > >
> **********************************************************/
> > > > > > > > > >
> > > > > > > > > > #define PLOCK 0x400
> > > > > > > > > >
> > > > > > > > > > void system_init(void)
> > > > > > > > > > {
> > > > > > > > > > // Setting Multiplier and Divider values
> > > > > > > > > > PLLCFG=0x24;
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > // Enabling the PLL */
> > > > > > > > > > PLLCON=0x1;
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > // Wait for the PLL to lock to set frequency
> > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > > > > > >
> > > > > > > > > > // Connect the PLL as the clock source
> > > > > > > > > > PLLCON=0x3;
> > > > > > > > > > feed();
> > > > > > > > > >
> > > > > > > > > > // Enabling MAM and setting number of clocks used for
> > > > > > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > > > > > //MAMTIM=0x3; //VCOM?
> > > > > > > > > > MAMCR=0x2;
> > > > > > > > > > MAMTIM=0x4; //Original
> > > > > > > > >
> > > > > > > > > It may not matter, but I usually change the MAM timing
> values
> > > > > > > > > prior to enabling the PLL. My rational is that if the
> values
> > > > > > > > > are set wrong when already running at 60MHz, how could
> I expect
> > > > > > > > > to reliably set them? Since there is no guarantee that I
> > > can read
> > > > > > > > > from flash if they are set for a lower clock rate.
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > // Setting peripheral Clock (pclk) to System Clock (cclk)
> > > > > > > > > > VPBDIV=0x1;
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Like I said before, your initialization looks fine, but I
> > > > > suspect the
> > > > > > > > > problem you are having might be elsewhere. So it would be
> > > useful to
> > > > > > > > > see the rest of your serial port code. Perhaps there is
> > > some timing
> > > > > > > > > issue that occurs when you run 5 times slower.
> > > > > > > > >
> > > > > > > > > When I developed my UART code, I had all sorts of problems
> > > that
> > > > > would
> > > > > > > > > occur at times, with seemingly no explanation, until I
> > > figured out
> > > > > > > > > the problem. It was very non-obvious at the time.
> > > > > > > > >
> > > > > > > > > So, if you can, break this down into a small piece of
> code that
> > > > > > > > > demonstrates the problem, I'll take a look at it.
> > > > > > > > >
> > > > > > > > > Mike
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > , "Michael Anton"
> > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > Perhaps you could post the balance of your UART
> code. The
> > > > > > > > > > initialization
> > > > > > > > > > > looks fine to me.
> > > > > > > > > > >
> > > > > > > > > > > Have you tried using only 12MHz, and not going into
> 60MHz?
> > > > > > > > > > Just to see if
> > > > > > > > > > > it is the changing
> > > > > > > > > > > between the clock speeds that has something to do
> with the
> > > > > > > > > > behaviour you are
> > > > > > > > > > > seeing.
> > > > > > > > > > >
> > > > > > > > > > > Mike
> > > > > > > > > > >
> > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > From: l...@yahoogroups.com
>
> > >
> > > > >
>
> > > > > > > > > > [mailto:l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > ]On Behalf Of
> > > > > > > > > > > ssonderhoff
> > > > > > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > > > > > To: l...@yahoogroups.com
>
> > >
> > > > >
>
> > > > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mhz
> > > > > > > > > > pclk - not working -
> > > > > > > > > > > Any Advice would be app.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > I will be appreciative for any insights, this is
> starting
> > > > > > > > > > to get quite
> > > > > > > > > > > frustrating.
> > > > > > > > > > >
> > > > > > > > > > > This is the code used to set the PLL to 60mhz. I
> modified
> > > > > > > > > > it to not set
> > > > > > > > > > > the PLL in slow mode (12mhz) on wake up and then
> eliminated
> > > > > > > > > > going to this
> > > > > > > > > > > code all together. all gave the same result. As i
> mentioned
> > > > > > > earlier,
> > > > > > > > > > > everything works fine at 60mhz, where as at 12 mhz
> it has
> > > > > > > > > > not worked with or
> > > > > > > > > > > without setting PLL. UART settings are in the previous
> > > message
> > > > > > > > > > >
> > > > > > > > > > > Thanks again,
> > > > > > > > > > > Stefan
> > > > > > > > > > >
> > > > > > > > > > > void PLL_init(int speed)
> > > > > > > > > > > {
> > > > > > > > > > >
> > > > > > > > > > > if(speed==fast){PLLCFG=0x24;} // Setting
> > > > > > > > > > Multiplier(5) and Divider(4)
> > > > > > > > > > > so 5xosc (12mhz) = 60 mhz
> > > > > > > > > > > else{VPBDIV = 0x1; return;} //pclk = cclk PLLCFG=0x60
> > > > > > > > > > >
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to lock
> > > to set
> > > > > > > > > > > frequency
> > > > > > > > > > >
> > > > > > > > > > > PLLCON=0x3;// Connect the PLL as the clock source
> > > > > > > > > > > feed();
> > > > > > > > > > > }
> > > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > , "ssonderhoff"
> > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > I removed the setting the PLL - after wake up I
> do not
> > > > > set PLL -
> > > > > > > > > > > > same problem - UART0 outputs garbage (see sample)
> > > > > > > > > > > >
> > > > > > > > > > > > 0£7*6@î0£7*6@®0£w*4@®0£w*4.
> > > > > > > > > > > >
> > > > > > > > > > > > the light on the serial connection is blinking
> and the
> > > > > > > > > > junk is being
> > > > > > > > > > > output at a regular interval. these are the
> settings used
> > > > > > > > > > to set the baud
> > > > > > > > > > > rate to 9600 - They seem correct to me
> > > > > > > > > > > >
> > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop bit,
> DLAB = 1
> > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > U0DLL = 0x4E; //lsb = 78
> > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > U0LCR &= ~(0x80); // turn off DLAB //U0LCR = x03;
> > > > > > > > > > > > //VICIntEnClr = 0x00000040;
> > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > >
> > > > > > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > > > > > Stefan
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > > , Sutton Mehaffey sutton@
> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I don't turn PLL on when I use PCLK=CCLK. Mine
> works
> > > > > > > > > > fine. Try it and
> > > > > > > > > > > > > see if it fixes your problem. I think you only need
> > > > > > > > > > PLL on if you need
> > > > > > > > > > > > > more speed than PCLK.
> > > > > > > > > > > > >
> > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Thanks for the reply. I am running at 12mhz, and
> > > > > > > > > > the I have a
> > > > > > > > > > > blinking
> > > > > > > > > > > > > > light that confirms that this is the case, along
> > > > > > > > > > with a decrease in
> > > > > > > > > > > > > > power draw. I am setting the multiplier(M) to
> 1. I
> > > > > > > > > > thought that you
> > > > > > > > > > > > > > had to specify the M and P values as well as
> select
> > > > > > > > > > the external
> > > > > > > > > > > > > > oscillator. Could this be screwing things up? How
> > > > > > > > > > does one avoid
> > > > > > > > > > > using
> > > > > > > > > > > > > > the PLL? on waking up from sleep mode, do you
> bother
> > > > > setting
> > > > > > > > > > > anything,
> > > > > > > > > > > > > > or should you actively disable the PLL by setting
> > > > > > > > > > PLLC and PLLE to
> > > > > > > > > > > 0?
> > > > > > > > > > > > > > I assume that Pclk would then = cclk.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Thanks again for the advice
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > --- In l...@yahoogroups.com
>
> > >
> > > > >
> > > > > > >
> > > > > > > > > > ,
> > > > > > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > What's your Fosc? If it is 12, I don't
> think you
> > > > > > > > > > need to activate
> > > > > > > > > > > PLL0,
> > > > > > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Perhaps I should re-state the question. The
> > > > > > > > > > PLLCFG and UART)
> > > > > > > > > > > settings
> > > > > > > > > > > > > > > > seem to be correct - Please let me know
> if you
> > > > > > > > > > can see some
> > > > > > > > > > > > > > mistake - Is
> > > > > > > > > > > > > > > > there anything else that could affect UART0
> > > > > > > > > > after a cclk change.
> > > > > > > > > > > The
> > > > > > > > > > > > > > > > port is active, but the output is
> garbage. Any
> > > > > > > > > > thoughts would be
> > > > > > > > > > > > > > welcome.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > > > > > ,
> > > > > > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I am running the lpc2148 at a low clock
> speed
> > > > > > > > > > of 12 mhz to
> > > > > > > > > > > reduce
> > > > > > > > > > > > > > > > power usage. This is working, the power
> > > > > > > > > > consumption is down and
> > > > > > > > > > > a
> > > > > > > > > > > > > > light
> > > > > > > > > > > > > > > > blinks at the correct rate. for each speed I
> > > > > > > > > > reset the Uart0
> > > > > > > > > > > > > > parameters
> > > > > > > > > > > > > > > > to take the pclk into account (code below)
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > the PLL_int(code below) sets processor to
> > > > > 12mhz(slow).
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > At 60mhz Everything is working fine
> fine and
> > > > > > > > > > I can read the
> > > > > > > > > > > output
> > > > > > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > At 12 mhz it outputs nothing but garbage, I
> > > > > > > > > > have tried setting
> > > > > > > > > > > to
> > > > > > > > > > > > > > > > different baud rates from low to high
> with the
> > > > > > > > > > same result.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > The Uart settings were determined using the
> > > > > > > > > > NXP lpc2000
> > > > > > > > > > > calculator
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I believe that I have faithfully
> followed the
> > > > > > > > > > data sheet. Can
> > > > > > > > > > > > > > anyone
> > > > > > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > > > > Stefan
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > > > > > void PLL_init(int speed) // sets clock
> speed
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > if(speed==fast) {PLLCFG=0x24; } // Setting
> > > > > > > > > > Multiplier(5) and
> > > > > > > > > > > > > > > > Divider(4) so 5xosc (12mhz) = 60 mhz
> > > > > > > > > > > > > > > > > else{PLLCFG= 0x60;VPBDIV = 0x1;} //Setting
> > > > > > > > > > Multiplier(1) and
> > > > > > > > > > > > > > > > Divider(8) 1xosc = 12mhz: pclk = cclk
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > PLLCON=0x1; // Enabling the PLL
> > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the
> > > > > > > > > > PLL to lock to set
> > > > > > > > > > > > > > frequency
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > PLLCON=0x3;/ / Connect the PLL as the
> clock
> > > source
> > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > //********** ********* ********* *********
> > > > > > > > > > ********* *********
> > > > > > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > > > > > void setuart(int speed) //sets up UART0
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > if(speed==fast)
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > > > > > bit, DLAB = 1
> > > > > > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > > > > > U0DLL = 0x20; //lsb = 32
> > > > > > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > > > > > U0LCR = 0x03; // 8 bit character length
> > > > > > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > else //initialize uart0 115200 buad 12mhz
> > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > U0LCR = 0x83; // 8 bits, no parity, 1 stop
> > > > > > > > > > bit, DLAB = 1
> > > > > > > > > > > > > > > > > U0DLM = 0x00; //msb = 0
> > > > > > > > > > > > > > > > > U0DLL = 0x6; //lsb = 6
> > > > > > > > > > > > > > > > > U0FDR = 0xC1; //fract divider divaddval(3:
> > > 0) = 1 &
> > > > > > > > > > > mulval(7:4) = 12
> > > > > > > > > > > > > > > > > U0FCR = 0x07; // enable and reset
> > > > > > > > > > > > > > > > > U0LCR = 0x03;
> > > > > > > > > > > > > > > > > VICIntEnClr = 0x00000040;
> > > > > > > > > > > > > > > > > U0IER = 0x00;
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > Sutton Mehaffey
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > ------------------------------------
> > > > > > > > > >
> > > > > > > > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 16:40:53 2010

The why of it is still a bit of a mystery to me but I appreciate all your i=
nput
Thanks,
Stefan

--- In l...@yahoogroups.com, Sutton Mehaffey wrote:
>
> I hear you and understand your issue. But, I put a breakpoint in my=20
> code after wakeup and the values of PLL0 had not changed. I'm not using=
=20
> any uarts, so I couldn't test any output. So, maybe even though the=20
> PLL0 values don't change, maybe you still have to reinitialize it to get=
=20
> it going. Don't have time to investigate, right now, however.
>=20
> Sutton
>=20
> ssonderhoff wrote:
> >=20=20
> >=20
> > According to the manual going to sleep disconnects the PLL which must=20
> > then be reconnected in software, this will not happen automatically. in=
=20
> > the absence of that, cclk =3D osc frequency. The PLL configuration is n=
ot=20
> > reset, but when I went to sleep at 60mhz and then actively reset them t=
o=20
> > the 12mhz immediately after waking up the cclk was set lower ( I timed=
=20
> > LED flashes that indicated that the processor speed was around 1/5 of=20
> > the before sleep rate) but Uart0 would only output garbage even after=20
> > resetting the uart0 settings. These same settings worked fine if the=20
> > cclk and uart0 were changed before sleep
> >=20
> > ie:
> > cclk 60mhz ->sleep-> set 12mhz and uart =3D uart outputs garbage
> > cclk 60mhz -> set 12mhz and uart -> sleep =3D uart output is fine
> >=20
> > Thanks,
> > Stefan
> >=20
> > --- In l...@yahoogroups.com ,=20
> > Sutton Mehaffey wrote:
> > >
> > > I just tried it. I had PCLK =3D CCLK =3D 12mhz (PLL off). I set it t=
o
> > > 18mhz before sleep mode (PLL0CON =3D 1, and PLL0CFG set to some valu=
e).
> > > It was still 18mhz after EINT3 wake up, with the same PLL0 values. S=
o,
> > > waking up after going to sleep mode does not reset PLL values. An
> > > actual reset (software or hardware) probably does.
> > >
> > >
> > >
> > > ssonderhoff wrote:
> > > >
> > > >
> > > > Going to sleep should disable PLL since you need to reset the PLL=
=20
> > after
> > > > waking.
> > > > Also, disabling the PLL after wake up if it was put to sleep at th=
e
> > > > higher cclk also did not resolve the Uart0 problem. It seems as th=
ough
> > > > you need to wake up the processor and set to the ?same? frequency =
that
> > > > it was prior to going to sleep, maybe this has something to do wit=
h=20
> > how
> > > > I put it to sleep?. I have not tried setting the PLL to the fast=20
> > cclk on
> > > > wakeup and then changing it to the lower
> > > > speed. I will try this evening.
> > > > Stefan
> > > >
> > > > --- In l...@yahoogroups.com =
=20
> > ,
> > > > Sutton Mehaffey wrote:
> > > > >
> > > > > I don't think that interrupt resets the PLL does it? You might=20
> > need to
> > > > > reset it to OFF manually.
> > > > >
> > > > >
> > > > >
> > > > > ssonderhoff wrote:
> > > > > >
> > > > > >
> > > > > > I am using EINT3 (non vectored).
> > > > > >
> > > > > > Once cclk was changed to 12 mhz before going to sleep, the uar=
t0
> > > > worked
> > > > > > fine before and after sleep. I have changed the baud rate up t=
o=20
> > 115200
> > > > > > and it still is working fine.
> > > > > >
> > > > > > --- In l...@yahoogroups.com=20
> >
> > > > ,
> > > > > > Sutton Mehaffey wrote:
> > > > > > >
> > > > > > > How are you waking the system back up? Pressing reset?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ssonderhoff wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > > Though I am not sure why. It turns out that if you shut of=
f=20
> > the
> > > > PLL
> > > > > > and
> > > > > > > > change UART) settings before you put the system to sleep,=
=20
> > then the
> > > > > > > > output is the desired text. If you go to sleep and then ru=
n the
> > > > > > > > identical code the output is the garbled nonsense I was
> > > > getting. Any
> > > > > > > > Ideas why this might be the case?
> > > > > > > > Thanks All,
> > > > > > > > Stefan
> > > > > > > >
> > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > ,
> > > > > > > > "ssonderhoff" wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > The board comes with the bootloader loaded and I have lo=
aded
> > > > all my
> > > > > > > > firmware using the bootlader. I would hate to overwrite th=
e
> > > > bootloader
> > > > > > > > and not be able to program the board. my test program puts=
the
> > > > > > computer
> > > > > > > > to sleep and then on wake up resets PLL or not, sets uart=
=20
> > and then
> > > > > > goes
> > > > > > > > into a loop and contsantly prints out a string. At 60mhz=20
> > everythng
> > > > > > works
> > > > > > > > and 12, not so much.
> > > > > > > > > Stefan
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > > om>
> > > > > > ,
> > > > > > > > "Michael Anton" wrote:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > From: l...@yahoogroups.com=20
> >
> > > >
> > > > > > =20
> >
> > > > > > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > ]On Behalf
> > > > > > > > > > > Of ssonderhoff
> > > > > > > > > > > Sent: Monday, February 08, 2010 10:54 PM
> > > > > > > > > > > To: l...@yahoogroups.com=20
> >
> > > >
> > > > > > =20
> >
> > > > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12mh=
z=20
> > pclk -
> > > > > > > > > > > not working
> > > > > > > > > > > - Any Advice would be app.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Hi,
> > > > > > > > > > > The system boots up using a boot loader that allows=
=20
> > the unit
> > > > > > > > > > > to act as a thumb drive and access an SD card as wel=
l=20
> > as load
> > > > > > > > > > > firmware updates from the sd card. This code=20
> > initializes the
> > > > > > > > > > > system and sets the initial PLL and is difficult and
> > > > > > > > > > > dangerous for me to change. the code used to set PLL=
=20
> > in the
> > > > > > > > > > > bootloader's Boot_up and system_init routines are=20
> > shown below
> > > > > > > > > > > shown below:
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Couldn't you write a piece of standalone test code, wi=
thout
> > > > > > > > > > the bootloader, to test your routines when running at=
=20
> > 12MHz?
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > void boot_up(void)
> > > > > > > > > > > {
> > > > > > > > > > > //Initialize the MCU clock PLL
> > > > > > > > > > > system_init();
> > > > > > > > > > >
> > > > > > > > > > > IODIR0 |=3D (1 << 31);
> > > > > > > > > > > IOCLR0 |=3D (1 << 31); //Turn on USB LED
> > > > > > > > > > >
> > > > > > > > > > > //Init UART0 for debug
> > > > > > > > > > > PINSEL0 |=3D 0x00000005; //enable uart0
> > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no Parity, 1 Stop bit, DL=
AB =3D 1
> > > > > > > > > > > U0DLM =3D 0x00;
> > > > > > > > > > > U0DLL =3D 0x20; // 115200 Baud Rate @ 58982400 VPB C=
lock
> > > > > > > > > >
> > > > > > > > > > So are you using a 58982400Hz clock, or 60MHz? If this=
=20
> > is not
> > > > > > > > > > 60MHz, you will likely encounter USB problems, as=20
> > obviously you
> > > > > > > > > > cannot reach 48MHz with enough accuracy either.
> > > > > > > > > >
> > > > > > > > > > > U0LCR =3D 0x03; // DLAB =3D 0
> > > > > > > > > > >
> > > > > > > > > > > //Init rprintf
> > > > > > > > > > > rprintf_devopen(putc_serial0);
> > > > > > > > > > > rprintf("\n\n\nUSB Bootloader v1.1\n");
> > > > > > > > > > >
> > > > > > > > > > > //IOSET0 |=3D (1 << 31); //Turn off USB LED
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > >=20
> > /**********************************************************
> > > > > > > > > > > Initialize
> > > > > > > > > > >=20
> > **********************************************************/
> > > > > > > > > > >
> > > > > > > > > > > #define PLOCK 0x400
> > > > > > > > > > >
> > > > > > > > > > > void system_init(void)
> > > > > > > > > > > {
> > > > > > > > > > > // Setting Multiplier and Divider values
> > > > > > > > > > > PLLCFG=3D0x24;
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > // Enabling the PLL */
> > > > > > > > > > > PLLCON=3D0x1;
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > // Wait for the PLL to lock to set frequency
> > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;
> > > > > > > > > > >
> > > > > > > > > > > // Connect the PLL as the clock source
> > > > > > > > > > > PLLCON=3D0x3;
> > > > > > > > > > > feed();
> > > > > > > > > > >
> > > > > > > > > > > // Enabling MAM and setting number of clocks used fo=
r
> > > > > > > > > > > Flash memory fetch (4 cclks in this case)
> > > > > > > > > > > //MAMTIM=3D0x3; //VCOM?
> > > > > > > > > > > MAMCR=3D0x2;
> > > > > > > > > > > MAMTIM=3D0x4; //Original
> > > > > > > > > >
> > > > > > > > > > It may not matter, but I usually change the MAM timing=
=20
> > values
> > > > > > > > > > prior to enabling the PLL. My rational is that if the=
=20
> > values
> > > > > > > > > > are set wrong when already running at 60MHz, how could=
=20
> > I expect
> > > > > > > > > > to reliably set them? Since there is no guarantee that=
I
> > > > can read
> > > > > > > > > > from flash if they are set for a lower clock rate.
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > // Setting peripheral Clock (pclk) to System Clock (=
cclk)
> > > > > > > > > > > VPBDIV=3D0x1;
> > > > > > > > > > > }
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Like I said before, your initialization looks fine, bu=
t I
> > > > > > suspect the
> > > > > > > > > > problem you are having might be elsewhere. So it would=
be
> > > > useful to
> > > > > > > > > > see the rest of your serial port code. Perhaps there i=
s
> > > > some timing
> > > > > > > > > > issue that occurs when you run 5 times slower.
> > > > > > > > > >
> > > > > > > > > > When I developed my UART code, I had all sorts of prob=
lems
> > > > that
> > > > > > would
> > > > > > > > > > occur at times, with seemingly no explanation, until I
> > > > figured out
> > > > > > > > > > the problem. It was very non-obvious at the time.
> > > > > > > > > >
> > > > > > > > > > So, if you can, break this down into a small piece of=
=20
> > code that
> > > > > > > > > > demonstrates the problem, I'll take a look at it.
> > > > > > > > > >
> > > > > > > > > > Mike
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > , "Michael Anton" n@>
> > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > Perhaps you could post the balance of your UART=20
> > code. The
> > > > > > > > > > > initialization
> > > > > > > > > > > > looks fine to me.
> > > > > > > > > > > >
> > > > > > > > > > > > Have you tried using only 12MHz, and not going int=
o=20
> > 60MHz?
> > > > > > > > > > > Just to see if
> > > > > > > > > > > > it is the changing
> > > > > > > > > > > > between the clock speeds that has something to do=
=20
> > with the
> > > > > > > > > > > behaviour you are
> > > > > > > > > > > > seeing.
> > > > > > > > > > > >
> > > > > > > > > > > > Mike
> > > > > > > > > > > >
> > > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > > From: l...@yahoogroups.com=20
> >
> > > >
> > > > > > =20
> >
> > > > > > > > > > > [mailto:l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > ]On Behalf Of
> > > > > > > > > > > > ssonderhoff
> > > > > > > > > > > > Sent: Monday, February 08, 2010 8:46 PM
> > > > > > > > > > > > To: l...@yahoogroups.com=20
> >
> > > >
> > > > > > =20
> >
> > > > > > > > > > > > Subject: [lpc2000] Re: LPC2148 setting Uart0 at 12=
mhz
> > > > > > > > > > > pclk - not working -
> > > > > > > > > > > > Any Advice would be app.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > I will be appreciative for any insights, this is=20
> > starting
> > > > > > > > > > > to get quite
> > > > > > > > > > > > frustrating.
> > > > > > > > > > > >
> > > > > > > > > > > > This is the code used to set the PLL to 60mhz. I=20
> > modified
> > > > > > > > > > > it to not set
> > > > > > > > > > > > the PLL in slow mode (12mhz) on wake up and then=20
> > eliminated
> > > > > > > > > > > going to this
> > > > > > > > > > > > code all together. all gave the same result. As i=
=20
> > mentioned
> > > > > > > > earlier,
> > > > > > > > > > > > everything works fine at 60mhz, where as at 12 mhz=
=20
> > it has
> > > > > > > > > > > not worked with or
> > > > > > > > > > > > without setting PLL. UART settings are in the prev=
ious
> > > > message
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks again,
> > > > > > > > > > > > Stefan
> > > > > > > > > > > >
> > > > > > > > > > > > void PLL_init(int speed)
> > > > > > > > > > > > {
> > > > > > > > > > > >
> > > > > > > > > > > > if(speed=3D=3Dfast){PLLCFG=3D0x24;} // Setting
> > > > > > > > > > > Multiplier(5) and Divider(4)
> > > > > > > > > > > > so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > > > else{VPBDIV =3D 0x1; return;} //pclk =3D cclk PLLC=
FG=3D0x60
> > > > > > > > > > > >
> > > > > > > > > > > > feed();
> > > > > > > > > > > >
> > > > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > > > feed();
> > > > > > > > > > > >
> > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for the PLL to =
lock
> > > > to set
> > > > > > > > > > > > frequency
> > > > > > > > > > > >
> > > > > > > > > > > > PLLCON=3D0x3;// Connect the PLL as the clock sourc=
e
> > > > > > > > > > > > feed();
> > > > > > > > > > > > }
> > > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > , "ssonderhoff"
> > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I removed the setting the PLL - after wake up I=
=20
> > do not
> > > > > > set PLL -
> > > > > > > > > > > > > same problem - UART0 outputs garbage (see sample=
)
> > > > > > > > > > > > >
> > > > > > > > > > > > > 0=A37*6@=13=19=EE0=A37*6@=13=19=AE0=A3w*4@=13=19=
=AE0=A3w*4.
> > > > > > > > > > > > >
> > > > > > > > > > > > > the light on the serial connection is blinking=20
> > and the
> > > > > > > > > > > junk is being
> > > > > > > > > > > > output at a regular interval. these are the=20
> > settings used
> > > > > > > > > > > to set the baud
> > > > > > > > > > > > rate to 9600 - They seem correct to me
> > > > > > > > > > > > >
> > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, 1 stop bit=
,=20
> > DLAB =3D 1
> > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > U0DLL =3D 0x4E; //lsb =3D 78
> > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > U0LCR &=3D ~(0x80); // turn off DLAB //U0LCR =3D=
x03;
> > > > > > > > > > > > > //VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > >
> > > > > > > > > > > > > I am at a loss and would appreciate any help
> > > > > > > > > > > > > Stefan
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > > , Sutton Mehaffey sutton=
@=20
> > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I don't turn PLL on when I use PCLK=3DCCLK. Mi=
ne=20
> > works
> > > > > > > > > > > fine. Try it and
> > > > > > > > > > > > > > see if it fixes your problem. I think you only=
need
> > > > > > > > > > > PLL on if you need
> > > > > > > > > > > > > > more speed than PCLK.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Thanks for the reply. I am running at 12mhz,=
and
> > > > > > > > > > > the I have a
> > > > > > > > > > > > blinking
> > > > > > > > > > > > > > > light that confirms that this is the case, a=
long
> > > > > > > > > > > with a decrease in
> > > > > > > > > > > > > > > power draw. I am setting the multiplier(M) t=
o=20
> > 1. I
> > > > > > > > > > > thought that you
> > > > > > > > > > > > > > > had to specify the M and P values as well as=
=20
> > select
> > > > > > > > > > > the external
> > > > > > > > > > > > > > > oscillator. Could this be screwing things up=
? How
> > > > > > > > > > > does one avoid
> > > > > > > > > > > > using
> > > > > > > > > > > > > > > the PLL? on waking up from sleep mode, do yo=
u=20
> > bother
> > > > > > setting
> > > > > > > > > > > > anything,
> > > > > > > > > > > > > > > or should you actively disable the PLL by se=
tting
> > > > > > > > > > > PLLC and PLLE to
> > > > > > > > > > > > 0?
> > > > > > > > > > > > > > > I assume that Pclk would then =3D cclk.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Thanks again for the advice
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --- In l...@yahoogroups.com=20
> >
> > > >
> > > > > >
> > > > > > > >
> > > > > > > > > > > ,
> > > > > > > > > > > > > > > Sutton Mehaffey wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > What's your Fosc? If it is 12, I don't=20
> > think you
> > > > > > > > > > > need to activate
> > > > > > > > > > > > PLL0,
> > > > > > > > > > > > > > > > if that's your CCLK speed.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > ssonderhoff wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Perhaps I should re-state the question. =
The
> > > > > > > > > > > PLLCFG and UART)
> > > > > > > > > > > > settings
> > > > > > > > > > > > > > > > > seem to be correct - Please let me know=
=20
> > if you
> > > > > > > > > > > can see some
> > > > > > > > > > > > > > > mistake - Is
> > > > > > > > > > > > > > > > > there anything else that could affect UA=
RT0
> > > > > > > > > > > after a cclk change.
> > > > > > > > > > > > The
> > > > > > > > > > > > > > > > > port is active, but the output is=20
> > garbage. Any
> > > > > > > > > > > thoughts would be
> > > > > > > > > > > > > > > welcome.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > --- In lpc2000@yahoogroups .com
> > > > > > > > > > > > ,
> > > > > > > > > > > > > > > > > "ssonderhoff" wrote:
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > I am running the lpc2148 at a low cloc=
k=20
> > speed
> > > > > > > > > > > of 12 mhz to
> > > > > > > > > > > > reduce
> > > > > > > > > > > > > > > > > power usage. This is working, the power
> > > > > > > > > > > consumption is down and
> > > > > > > > > > > > a
> > > > > > > > > > > > > > > light
> > > > > > > > > > > > > > > > > blinks at the correct rate. for each spe=
ed I
> > > > > > > > > > > reset the Uart0
> > > > > > > > > > > > > > > parameters
> > > > > > > > > > > > > > > > > to take the pclk into account (code belo=
w)
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > the PLL_int(code below) sets processor=
to
> > > > > > 12mhz(slow).
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > At 60mhz Everything is working fine=20
> > fine and
> > > > > > > > > > > I can read the
> > > > > > > > > > > > output
> > > > > > > > > > > > > > > > > debug text without any problem.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > At 12 mhz it outputs nothing but garba=
ge, I
> > > > > > > > > > > have tried setting
> > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > different baud rates from low to high=20
> > with the
> > > > > > > > > > > same result.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > The Uart settings were determined usin=
g the
> > > > > > > > > > > NXP lpc2000
> > > > > > > > > > > > calculator
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > I believe that I have faithfully=20
> > followed the
> > > > > > > > > > > data sheet. Can
> > > > > > > > > > > > > > > anyone
> > > > > > > > > > > > > > > > > tell me what I am missing?
> > > > > > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > > > > > Stefan
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > //*********CODE* ********* *
> > > > > > > > > > > > > > > > > > void PLL_init(int speed) // sets clock=
=20
> > speed
> > > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > if(speed=3D=3Dfast) {PLLCFG=3D0x24; } =
// Setting
> > > > > > > > > > > Multiplier(5) and
> > > > > > > > > > > > > > > > > Divider(4) so 5xosc (12mhz) =3D 60 mhz
> > > > > > > > > > > > > > > > > > else{PLLCFG=3D 0x60;VPBDIV =3D 0x1;} /=
/Setting
> > > > > > > > > > > Multiplier(1) and
> > > > > > > > > > > > > > > > > Divider(8) 1xosc =3D 12mhz: pclk =3D ccl=
k
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > PLLCON=3D0x1; // Enabling the PLL
> > > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > while(!(PLLSTAT & PLOCK)) ;// Wait for=
the
> > > > > > > > > > > PLL to lock to set
> > > > > > > > > > > > > > > frequency
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > PLLCON=3D0x3;/ / Connect the PLL as th=
e=20
> > clock
> > > > source
> > > > > > > > > > > > > > > > > > feed();
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > > //********** ********* ********* *****=
****
> > > > > > > > > > > ********* *********
> > > > > > > > > > > > > > > > > ********* ***
> > > > > > > > > > > > > > > > > > void setuart(int speed) //sets up UART=
0
> > > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > if(speed=3D=3Dfast)
> > > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, =
1 stop
> > > > > > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > > > > > U0DLL =3D 0x20; //lsb =3D 32
> > > > > > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > > > > > U0LCR =3D 0x03; // 8 bit character len=
gth
> > > > > > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > > else //initialize uart0 115200 buad 12=
mhz
> > > > > > > > > > > > > > > > > > {
> > > > > > > > > > > > > > > > > > U0LCR =3D 0x83; // 8 bits, no parity, =
1 stop
> > > > > > > > > > > bit, DLAB =3D 1
> > > > > > > > > > > > > > > > > > U0DLM =3D 0x00; //msb =3D 0
> > > > > > > > > > > > > > > > > > U0DLL =3D 0x6; //lsb =3D 6
> > > > > > > > > > > > > > > > > > U0FDR =3D 0xC1; //fract divider divadd=
val(3:
> > > > 0) =3D 1 &
> > > > > > > > > > > > mulval(7:4) =3D 12
> > > > > > > > > > > > > > > > > > U0FCR =3D 0x07; // enable and reset
> > > > > > > > > > > > > > > > > > U0LCR =3D 0x03;
> > > > > > > > > > > > > > > > > > VICIntEnClr =3D 0x00000040;
> > > > > > > > > > > > > > > > > > U0IER =3D 0x00;
> > > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > }
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > > Sutton Mehaffey
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > ------------------------------------
> > > > > > > > > > >
> > > > > > > > > > >



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - brian_myers888 - Feb 9 16:52:13 2010

Just to be clear - on wakeup from sleep, you call the PLL init function which waits for PLL lock, right? i.e. it's not enough to simply re-connect the PLL, you need to wait for the PLL to lock and THEN connect (which I assume you are doing, but I didn't see your sleep/wakeup code).

Also, are you very sure that your "feed()" function is not interrupted during the wake-up call? That could thwart the PLL-connect. You should keep your UART interrupts disabled until after the PLL has been re-initialised (after wake from sleep). Again, I assume this is what you're doing.

You should be able to do the PLL init to whatever speed you want, on wakeup - what you do to it before sleeping should not matter (*should* I guess being the key word here!). Very odd. Please post if you ever find out exactly what's going on.

regards,
Brian

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - brian_myers888 - Feb 9 17:00:55 2010

I just noticed that your pll init function (as posted earlier) has an early "return" in the low-speed path - it is not setting the PLL up at all.

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 18:10:11 2010

I definitely will update it if find the source of this behavior.
I do feed, wait for the PLL to stabilize before the connecting and the second feed. I cannot see how the feed function could be interrupted in my case. UART is not configured until after the PLL is initialized

UART, and pretty much everything else is shut down during sleep in PCONP. I tried connecting the PLL & UART both before and after external devices we activated but the outcome was the same.
Stefan
--- In l...@yahoogroups.com, "brian_myers888" wrote:
>
> Just to be clear - on wakeup from sleep, you call the PLL init function which waits for PLL lock, right? i.e. it's not enough to simply re-connect the PLL, you need to wait for the PLL to lock and THEN connect (which I assume you are doing, but I didn't see your sleep/wakeup code).
>
> Also, are you very sure that your "feed()" function is not interrupted during the wake-up call? That could thwart the PLL-connect. You should keep your UART interrupts disabled until after the PLL has been re-initialised (after wake from sleep). Again, I assume this is what you're doing.
>
> You should be able to do the PLL init to whatever speed you want, on wakeup - what you do to it before sleeping should not matter (*should* I guess being the key word here!). Very odd. Please post if you ever find out exactly what's going on.
>
> regards,
> Brian
>

------------------------------------

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC2148 setting Uart0 at 12mhz pclk - not working - SOLVED. - ssonderhoff - Feb 9 18:15:17 2010

This is true, and was one of the many attempts made. I tried setting up PLL and then leaving it disconnected, as in this case, since at 12mhz cclk = osc. Both methods gave the same result according to the change speed afterwake -> uart0 produces junk

I am currently using this now that the speed was changed before sleep and it works fine.

--- In l...@yahoogroups.com, "brian_myers888" wrote:
>
> I just noticed that your pll init function (as posted earlier) has an early "return" in the low-speed path - it is not setting the PLL up at all.
>

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )