Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

LPC Baud Rate Question???

LPC Baud Rate Question???

2003-11-26 by David Bermingham

Hi,
Im looking for Help on the UART initialisation for the LPC, I need a BAUD rate of 57600 bps but cant figure out the correct values to write to the DLM/DLL registers...
 
A CCLK value of 60Mhz will give a default VPB(pclk) speed of 15MHz...Yes??
The value in the DLM/DLL registers has to be 16 time the desired baud rate, which gives 57600x16 = 921600. But this number is a 20 Bit Integer....
            .....11100001 00000000 0000.
 
Please can somebody explain where my calculations are going wrong..or do I have to slow the processor down to get the required Baud rate???
 
Thanks
David



---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

Re: LPC Baud Rate Question???

2003-11-26 by leon_heller

--- In lpc2100@yahoogroups.com, David Bermingham <crwpulsar@y...> wrote:
> Hi,
> Im looking for Help on the UART initialisation for the LPC, I need a
BAUD rate of 57600 bps but cant figure out the correct values to write
to the DLM/DLL registers...
>  
> A CCLK value of 60Mhz will give a default VPB(pclk) speed of
15MHz...Yes??
> The value in the DLM/DLL registers has to be 16 time the desired
baud rate, which gives 57600x16 = 921600. But this number is a 20 Bit
Integer....
>             .....11100001 00000000 0000.
>  
> Please can somebody explain where my calculations are going
wrong..or do I have to slow the processor down to get the required
Baud rate???


Aren't the Baud Rate Generators driven by the VPB clock (pclk), not clck.

Leon

Re: LPC Baud Rate Question???

2003-11-26 by Bill Knight

--- In lpc2100@yahoogroups.com, David Bermingham <crwpulsar@y...> wrote:
> Hi,
> Im looking for Help on the UART initialisation for the LPC, I need a
BAUD rate of 57600 bps but cant figure out the correct values to write
to the DLM/DLL registers...
>  
> A CCLK value of 60Mhz will give a default VPB(pclk) speed of
15MHz...Yes??
> The value in the DLM/DLL registers has to be 16 time the desired
baud rate, which gives 57600x16 = 921600. But this number is a 20 Bit
Integer....
>             .....11100001 00000000 0000.
>  
> Please can somebody explain where my calculations are going
wrong..or do I have to slow the processor down to get the required
Baud rate???


The 16x BAUD is the BAUD clock.  To get it, you enter the divisor
to get to it from the VPB(pclk) into DLM/DLL = 15MHz/921600 ~= 16
As I am writing this w/o specific info on the part, please check
the docs to see if the value entered is actually 16 or 16-1.
Different parts do it differently.

Hope this helps some.

-Bill Knight
R O SOftWare

Re: [lpc2100] LPC Baud Rate Question???

2003-11-26 by Robert Adsett

At 07:26 AM 11/26/03 -0800, you wrote:
>Hi,
>Im looking for Help on the UART initialisation for the LPC, I need a BAUD 
>rate of 57600 bps but cant figure out the correct values to write to the 
>DLM/DLL registers...
>
>A CCLK value of 60Mhz will give a default VPB(pclk) speed of 15MHz...Yes??
>The value in the DLM/DLL registers has to be 16 time the desired baud 
>rate, which gives 57600x16 = 921600. But this number is a 20 Bit Integer....
>             .....11100001 00000000 0000.
>
>Please can somebody explain where my calculations are going wrong..or do I 
>have to slow the processor down to get the required Baud rate???

The value in the dividers (DLM/DLL) is the value required to bring the 
clock rate down to baud*16

pclk/div = 16*baud
div = pclk/(16*baud)
div = 15000000/921600 = 16.27

A divider of 16 will give you a baud rate 1.7% high which should work.

It's exactly like the 8250/16450/16550 chips.  I think they just used a 
16550 core from the looks of things.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [lpc2100] Re: LPC Baud Rate Question???

2003-11-26 by Leon Heller

----- Original Message ----- 
Show quoted textHide quoted text
From: "leon_heller" <leon_heller@...>
To: <lpc2100@yahoogroups.com>
Sent: Wednesday, November 26, 2003 3:47 PM
Subject: [lpc2100] Re: LPC Baud Rate Question???


> --- In lpc2100@yahoogroups.com, David Bermingham <crwpulsar@y...> wrote:
> > Hi,
> > Im looking for Help on the UART initialisation for the LPC, I need a
> BAUD rate of 57600 bps but cant figure out the correct values to write
> to the DLM/DLL registers...
> >
> > A CCLK value of 60Mhz will give a default VPB(pclk) speed of
> 15MHz...Yes??
> > The value in the DLM/DLL registers has to be 16 time the desired
> baud rate, which gives 57600x16 = 921600. But this number is a 20 Bit
> Integer....
> >             .....11100001 00000000 0000.
> >
> > Please can somebody explain where my calculations are going
> wrong..or do I have to slow the processor down to get the required
> Baud rate???
>
>
> Aren't the Baud Rate Generators driven by the VPB clock (pclk), not clck.

Sorry, you said that.

15000000/(16*9600) = 97.66 for 9600 baud.

Don't you just have to divide by 98 using the U0DLL and U0DLM divisor
registers?

Leon
--
Leon Heller, G1HSM
Email: aqzf13@...
http://www.geocities.com/leon_heller

Re: [lpc2100] Re: LPC Baud Rate Question???

2003-11-26 by David Bermingham

Ok...Let me see If I understand this because Im a bit
slow.........
   pclk = 15,000,000.
   Desired Baud Rate 57,600

Gives ...BAUD CLOCK = (57,600x16) = 921600
So my divider is pclk/BAUD CLOCK...
          15,000,000/921600 = 16.27604
         =>DLM_BAUD = 0x00;
         =>DLL_BAUD = 0x10;
Yes???
Ignore decimal points??
Thanks Again,
David

--- Bill Knight <BillK@...> wrote:
> --- In lpc2100@yahoogroups.com, David Bermingham
> <crwpulsar@y...> wrote:
> > Hi,
> > Im looking for Help on the UART initialisation for
> the LPC, I need a
> BAUD rate of 57600 bps but cant figure out the
> correct values to write
> to the DLM/DLL registers...
> >  
> > A CCLK value of 60Mhz will give a default
> VPB(pclk) speed of
> 15MHz...Yes??
> > The value in the DLM/DLL registers has to be 16
> time the desired
> baud rate, which gives 57600x16 = 921600. But this
> number is a 20 Bit
> Integer....
> >             .....11100001 00000000 0000.
> >  
> > Please can somebody explain where my calculations
> are going
> wrong..or do I have to slow the processor down to
> get the required
> Baud rate???
> 
> 
> The 16x BAUD is the BAUD clock.  To get it, you
> enter the divisor
> to get to it from the VPB(pclk) into DLM/DLL =
> 15MHz/921600 ~= 16
> As I am writing this w/o specific info on the part,
> please check
> the docs to see if the value entered is actually 16
> or 16-1.
> Different parts do it differently.
> 
> Hope this helps some.
> 
> -Bill Knight
> R O SOftWare
> 
> 
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

Re: LPC Baud Rate Question???

2003-11-26 by Robert Teufel

--- In lpc2100@yahoogroups.com, David Bermingham <crwpulsar@y...> wrote:
> Hi,
> Im looking for Help on the UART initialisation for the LPC, I need a
BAUD rate of 57600 bps but cant figure out the correct values to write
to the DLM/DLL registers...
>  
> A CCLK value of 60Mhz will give a default VPB(pclk) speed of
15MHz...Yes??
> The value in the DLM/DLL registers has to be 16 time the desired
baud rate, which gives 57600x16 = 921600. But this number is a 20 Bit
Integer....
>             .....11100001 00000000 0000.
>  
> Please can somebody explain where my calculations are going
wrong..or do I have to slow the processor down to get the required
Baud rate???
>  
> Thanks
> David

Hi David,
for serial baudrates just be "close enough". If you miss the target
baurate by less than 2.5% it is going to work! In order to hit the
57.6 kbaud, you van use a crystal running @ 14.7456 MHz. You will
reduce your performance by a stunning 1.7% :-) but for most
apllications this should not make a difference.
Cheers, Bob

Re: [lpc2100] Re: LPC Baud Rate Question???

2003-11-26 by Robert Adsett

At 10:47 AM 11/26/03 -0800, you wrote:
>Ok...Let me see If I understand this because Im a bit
>slow.........
>    pclk = 15,000,000.
>    Desired Baud Rate 57,600
>
>Gives ...BAUD CLOCK = (57,600x16) = 921600
>So my divider is pclk/BAUD CLOCK...
>           15,000,000/921600 = 16.27604
>          =>DLM_BAUD = 0x00;
>          =>DLL_BAUD = 0x10;
>Yes???

Yes

>Ignore decimal points??

Not quite.  Normally you want to round to the nearest value and then check 
the error.  Depending on your clock frequency you will find that some 
standard baud values may be simply inaccessible since the error is too high.

IE if your divide value worked out to 4.45, your mismatch to standard rate 
would be > 10% and it is unlikely that you could connect.

However a 2% error 'should' work just fine.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [lpc2100] Re: LPC Baud Rate Question???

2003-11-26 by Bill Knight

On Wed, 26 Nov 2003 14:13:42 -0500, Robert Adsett wrote:

At 10:47 AM 11/26/03 -0800, you wrote:
>Ok...Let me see If I understand this because Im a bit
>slow.........
>    pclk = 15,000,000.
>    Desired Baud Rate 57,600

>Gives ...BAUD CLOCK = (57,600x16) = 921600
>So my divider is pclk/BAUD CLOCK...
>           15,000,000/921600 = 16.27604
>          =>DLM_BAUD = 0x00;
>          =>DLL_BAUD = 0x10;
>Yes???

Yes

>Ignore decimal points??

Not quite.  Normally you want to round to the nearest value and then check 
the error.  Depending on your clock frequency you will find that some 
standard baud values may be simply inaccessible since the error is too high.

IE if your divide value worked out to 4.45, your mismatch to standard rate 
would be > 10% and it is unlikely that you could connect.

However a 2% error 'should' work just fine.

Robert


All

I typically do something like the following and let the compiler handle
the floating point.  NOTE: NO FLOATING POINT CODE IS CREATED!

#define CPU_CLK     (60.0e6)
#define PCLK        (CPU_CLK / 4)
#define BAUD_DIV(n) ((unsigned short)((PCLK / ((n) * 16)) + 0.5))
#define B57600      BAUD_DIV(57600)

Regards
-Bill Knight
R O SoftWare

Re: [lpc2100] LPC Baud Rate Question???

2003-11-28 by David Bermingham

Thanks to everybody for replying to my questions.It made a small part of a large project much easier........
 
David

Robert Adsett <radsett@...> wrote:
At 07:26 AM 11/26/03 -0800, you wrote:
>Hi,
>Im looking for Help on the UART initialisation for the LPC, I need a BAUD 
>rate of 57600 bps but cant figure out the correct values to write to the 
>DLM/DLL registers...
>
>A CCLK value of 60Mhz will give a default VPB(pclk) speed of 15MHz...Yes??
>The value in the DLM/DLL registers has to be 16 time the desired baud 
>rate, which gives 57600x16 = 921600. But this number is a 20 Bit Integer....
>             .....11100001 00000000 0000.
>
>Please can somebody explain where my calculations are going wrong..or do I 
>have to slow the processor down to get the required Baud rate???

The value in the dividers (DLM/DLL) is the value required to bring the 
clock rate down to baud*16

pclk/div = 16*baud
div = pclk/(16*baud)
div = 15000000/921600 = 16.27

A divider of 16 will give you a baud rate 1.7% high which should work.

It's exactly like the 8250/16450/16550 chips.  I think they just used a 
16550 core from the looks of things.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III


Yahoo! Groups SponsorADVERTISEMENT

To unsubscribe from this group, send an email to:
lpc2100-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.