EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2148 setting Uart0 at 12mhz pclk - not working

Started by ssonderhoff February 7, 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=t){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=t)
{
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;
}

}

An Engineer's Guide to the LPC2100 Series

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..., "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=t){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=t)
> {
> 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;
> }
>
> }
>

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=t) {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=t)
> > {
> > 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

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..., 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=t) {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=t)
> > > {
> > > 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@...
>

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..., 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=t) {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=t)
>> > > {
>> > > 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@...
>>
>
I don't turn PLL on when I use PCLKK. 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... ,
> 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=t) {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=t)
> > > > {
> > > > 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

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

07*6@7*6@0w*4@0w*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..., 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... ,
> > 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@...
>

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)
>
> 07*6@7*6@0w*4@0w*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... ,
> Sutton Mehaffey wrote:
> >
> > I don't turn PLL on when I use PCLKK. 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...
> ,
> > > 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=t) {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=t)
> > > > > > {
> > > > > > 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

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=t){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..., "ssonderhoff" wrote:
>
> I removed the setting the PLL - after wake up I do not set PLL -
> same problem - UART0 outputs garbage (see sample)
>
> 07*6@7*6@0w*4@0w*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..., Sutton Mehaffey sutton@ wrote:
> >
> > I don't turn PLL on when I use PCLKK. 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... ,
> > > 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=t) {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=t)
> > > > > > {
> > > > > > 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@
>
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... [mailto:l...]On Behalf Of
ssonderhoff
Sent: Monday, February 08, 2010 8:46 PM
To: l...
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=t){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..., "ssonderhoff" wrote:
>
> I removed the setting the PLL - after wake up I do not set PLL -
> same problem - UART0 outputs garbage (see sample)
>
> 07*6@7*6@0w*4@0w*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..., Sutton Mehaffey sutton@ wrote:
> >
> > I don't turn PLL on when I use PCLKK. 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... ,
> > > 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=t) {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=t)
> > > > > > {
> > > > > > 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

The 2024 Embedded Online Conference