Yahoo Groups archive

Lpc2000

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

Message

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

Attachments

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.