1
\$\begingroup\$

I'm little confused about the baud rate calculating equation of LPC2148

In data sheet equation is

enter image description here

enter image description here

But in every tutorial I could find

equation is

enter image description here

Second equation sets the baud rate as required.

Am I missing something?

Tutorials that I checked

  1. Link1
  2. Link2
  3. Link3
\$\endgroup\$
2
  • \$\begingroup\$ I have no experience with LPC2148, but equations are same if U0 stand for oversampling which is usually 16 (or 8 with faster baud rates). \$\endgroup\$
    – Rokta
    Commented Oct 11, 2018 at 6:53
  • \$\begingroup\$ @Rokta Here U0 stands for UART0, U0DLL & U0DLM are device latch registers of UART0 \$\endgroup\$
    – Athul
    Commented Oct 11, 2018 at 6:56

1 Answer 1

3
\$\begingroup\$

The only thing that makes sense is that the equation in the datasheet has an error.

That same datasheet says:

The U0DLL and U0DLM registers together form a 16 bit divisor where U0DLL contains the lower 8 bits of the divisor and U0DLM contains the higher 8 bits of the divisor

That suggests it should be 256*DLM+DLL as written in tutorials. In example tables below, it's also treated as 16-bits altogether (upper 8 + lower 8).

Note that April 2012 version of datasheet [1] contains the corrected equation.

[1] https://www.nxp.com/docs/en/user-guide/UM10139.pdf

\$\endgroup\$
3
  • \$\begingroup\$ I gave DLM = 1, DLL = 97, MULVAL = 14 & DIVADDVAL = 1, If equation was the one with 16 in denominator, Calculated baud rate would be 7743, and Equation with 256 in denominator would give 2478. I checked the value in Keil debugger, and the answer is 2478. So equation with 256 is the right one. \$\endgroup\$
    – Athul
    Commented Oct 12, 2018 at 19:15
  • \$\begingroup\$ Can you tell me how you got the denominator as 256 by the info of U0DLL & U0DLM \$\endgroup\$
    – Athul
    Commented Oct 12, 2018 at 19:17
  • \$\begingroup\$ Upper 8 bits means 1<<8 or 2**8, which is 256. \$\endgroup\$
    – domen
    Commented Oct 14, 2018 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.