iam using lpc2119 and i want to adjust the uart baud rate to 9600?

i did the following :

the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

so 19.6608Mhz\{16*9600} will give 128 decimal then it will be 0x0080 which is
the value i put in the divisor register.

the Question is does the default value of the lpc2119 is 19.6608Mhz or not
?

i didn't make any changes to the clock.

please help me getting this baud rate "9600 "

thank you

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

Food fight? Enjoy some healthy debate

in the Yahoo! Answers Food & Drink Q&A.

# PLEASE HELP

Started by ●July 2, 2007

Reply by ●July 2, 20072007-07-02

miro _eng wrote:

> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> i did the following :

> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

There is probably a rectangular metal component called a crystal

somewhere near your microcontroller, with a number on it.

If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

Bertrik

> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> i did the following :

> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

There is probably a rectangular metal component called a crystal

somewhere near your microcontroller, with a number on it.

If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

Bertrik

Reply by ●July 2, 20072007-07-02

--- In l..., Bertrik Sikken wrote:

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik

>i know this but when i used this baud rate " put 0x080" in the

divisor register then connect the uart to the hyperterminal via maxim

IC i received data at higher baud rate " rate adjusted in the hyper

termina ????"

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik

>i know this but when i used this baud rate " put 0x080" in the

divisor register then connect the uart to the hyperterminal via maxim

IC i received data at higher baud rate " rate adjusted in the hyper

termina ????"

Reply by ●July 2, 20072007-07-02

miro_voda_2008 wrote:

> --- In l..., Bertrik Sikken wrote:

>> miro _eng wrote:

>>> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

>>> i did the following :

>>> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>> There is probably a rectangular metal component called a crystal

>> somewhere near your microcontroller, with a number on it.

>> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>>

>> Bertrik

>> i know this but when i used this baud rate " put 0x080" in the

> divisor register then connect the uart to the hyperterminal via maxim

> IC i received data at higher baud rate " rate adjusted in the hyper

> termina ????"

(I'm only familiar with the LPC2292/2294 and the LPC2148)

It helps to understand how the various clocks are derived:

The processor clock (CCLK) is derived from the crystal clock by

multiplying with the PLL multiplier. The PCLK (peripheral clock)

is derived from the CCLK by dividing by the PCLK divider (VPBDIV).

The UART baudrate then derives from the PCLK as PCLK / (16 * UART

divider).

As far as I know, the PLL multiplier is 1 by default and the

PCLK divider is *4* by default. This gives a PCLK of 4.9152 MHz.

This means that a divider of 32 (not 128) should give a baud rate

of 9600.

Bertrik

> --- In l..., Bertrik Sikken wrote:

>> miro _eng wrote:

>>> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

>>> i did the following :

>>> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>> There is probably a rectangular metal component called a crystal

>> somewhere near your microcontroller, with a number on it.

>> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>>

>> Bertrik

>> i know this but when i used this baud rate " put 0x080" in the

> divisor register then connect the uart to the hyperterminal via maxim

> IC i received data at higher baud rate " rate adjusted in the hyper

> termina ????"

(I'm only familiar with the LPC2292/2294 and the LPC2148)

It helps to understand how the various clocks are derived:

The processor clock (CCLK) is derived from the crystal clock by

multiplying with the PLL multiplier. The PCLK (peripheral clock)

is derived from the CCLK by dividing by the PCLK divider (VPBDIV).

The UART baudrate then derives from the PCLK as PCLK / (16 * UART

divider).

As far as I know, the PLL multiplier is 1 by default and the

PCLK divider is *4* by default. This gives a PCLK of 4.9152 MHz.

This means that a divider of 32 (not 128) should give a baud rate

of 9600.

Bertrik

Reply by ●July 2, 20072007-07-02

Have you looked at the baud rate calculator provided by NXP?

www.standardics.*nxp*.com/support/documents/microcontrollers/xls/*lpc2000*

.uart.*baud**rate*.calculator.xls

If you have a Crystal of 19.6608Mhz (and the PLL disabled), then you need to

use (19.6608Mhz / 4) as the UART clock (assuming you haven't changed the

peripheral clocks).

On 7/3/07, miro _eng wrote:

>

> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> i did the following :

> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

> so 19.6608Mhz\{16*9600} will give 128 decimal then it will be 0x0080 which

> is the value i put in the divisor register.

> the Question is does the default value of the lpc2119 is 19.6608Mhz or not

> ?

> i didn't make any changes to the clock.

>

> please help me getting this baud rate "9600 "

> thank you

>

> ---------------------------------

> Food fight? Enjoy some healthy debate

> in the Yahoo! Answers Food & Drink Q&A.

>

>

>

>

>

www.standardics.*nxp*.com/support/documents/microcontrollers/xls/*lpc2000*

.uart.*baud**rate*.calculator.xls

If you have a Crystal of 19.6608Mhz (and the PLL disabled), then you need to

use (19.6608Mhz / 4) as the UART clock (assuming you haven't changed the

peripheral clocks).

On 7/3/07, miro _eng wrote:

>

> iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> i did the following :

> the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

> so 19.6608Mhz\{16*9600} will give 128 decimal then it will be 0x0080 which

> is the value i put in the divisor register.

> the Question is does the default value of the lpc2119 is 19.6608Mhz or not

> ?

> i didn't make any changes to the clock.

>

> please help me getting this baud rate "9600 "

> thank you

>

> ---------------------------------

> Food fight? Enjoy some healthy debate

> in the Yahoo! Answers Food & Drink Q&A.

>

>

>

>

>

Reply by ●July 2, 20072007-07-02

----- Original Message -----

From: "Chris Cook"

To:

Sent: Monday, July 02, 2007 11:53 PM

Subject: Re: [lpc2000] PLEASE HELP

> Have you looked at the baud rate calculator provided by NXP?

>

> www.standardics.*nxp*.com/support/documents/microcontrollers/xls/*lpc2000*

> .uart.*baud**rate*.calculator.xls

Try this:

Leon

From: "Chris Cook"

To:

Sent: Monday, July 02, 2007 11:53 PM

Subject: Re: [lpc2000] PLEASE HELP

> Have you looked at the baud rate calculator provided by NXP?

>

> www.standardics.*nxp*.com/support/documents/microcontrollers/xls/*lpc2000*

> .uart.*baud**rate*.calculator.xls

Try this:

Leon

Reply by ●July 3, 20072007-07-03

For normal UART operation assuming you're happy with the rounding errors

described in the spread sheet you can simply initialise as:

#define UART0_BAUD_RATE (19200)

#define OSCILLATOR_FREQUENCY (19660800) // Frequency of the Oscillator in

Hz

unsigned int cpu_frequency;

cpu_frequency = OSCILLATOR_FREQUENCY * ((PLLCFG & 0x1F) + 1);

U0LCR = 0x00000083; //8 bits, no Parity, 1 Stop bit

U0DLL = ((cpu_frequency >> (4 + (VPBDIV != 1) + (VPBDIV == 0))) /

UART0_BAUD_RATE) & 0xFF;

U0DLM = (((cpu_frequency >> (4 + (VPBDIV != 1) + (VPBDIV == 0))) /

UART0_BAUD_RATE) >> 8) & 0xFF;

U0LCR = 0x00000003; // DLAB = 0

U0FCR = 0x00000001; //Enable FIFO & trigger level to 1 byte

This will use your VPBDIV setting, CPU frequency, PLL multiplier and

designed baud rate to calculate the correct divisor for you...

Andy

-----Original Message-----

From: l... [mailto:l...]On Behalf Of

miro_voda_2008

Sent: 02 July 2007 23:09

To: l...

Subject: [lpc2000] Re: PLEASE HELP

--- In l..., Bertrik Sikken wrote:

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik

>i know this but when i used this baud rate " put 0x080" in the

divisor register then connect the uart to the hyperterminal via maxim

IC i received data at higher baud rate " rate adjusted in the hyper

termina ????"

described in the spread sheet you can simply initialise as:

#define UART0_BAUD_RATE (19200)

#define OSCILLATOR_FREQUENCY (19660800) // Frequency of the Oscillator in

Hz

unsigned int cpu_frequency;

cpu_frequency = OSCILLATOR_FREQUENCY * ((PLLCFG & 0x1F) + 1);

U0LCR = 0x00000083; //8 bits, no Parity, 1 Stop bit

U0DLL = ((cpu_frequency >> (4 + (VPBDIV != 1) + (VPBDIV == 0))) /

UART0_BAUD_RATE) & 0xFF;

U0DLM = (((cpu_frequency >> (4 + (VPBDIV != 1) + (VPBDIV == 0))) /

UART0_BAUD_RATE) >> 8) & 0xFF;

U0LCR = 0x00000003; // DLAB = 0

U0FCR = 0x00000001; //Enable FIFO & trigger level to 1 byte

This will use your VPBDIV setting, CPU frequency, PLL multiplier and

designed baud rate to calculate the correct divisor for you...

Andy

-----Original Message-----

From: l... [mailto:l...]On Behalf Of

miro_voda_2008

Sent: 02 July 2007 23:09

To: l...

Subject: [lpc2000] Re: PLEASE HELP

--- In l..., Bertrik Sikken wrote:

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik

>i know this but when i used this baud rate " put 0x080" in the

divisor register then connect the uart to the hyperterminal via maxim

IC i received data at higher baud rate " rate adjusted in the hyper

termina ????"

Reply by ●July 3, 20072007-07-03

assume 15Mhz

On 7/3/07, Bertrik Sikken wrote:

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik

On 7/3/07, Bertrik Sikken wrote:

>

> miro _eng wrote:

> > iam using lpc2119 and i want to adjust the uart baud rate to 9600?

> > i did the following :

> > the clockfreq " i assumed it is 19.6608 Mhz is this right ?"

>

> There is probably a rectangular metal component called a crystal

> somewhere near your microcontroller, with a number on it.

> If that number is 19.6608, then yes, it is 19.6608 MHz.. :)

>

> Bertrik