user1116185
user1116185

Reputation: 1

Baud rate setting for LP17XX micro controller

Hi am using LPC Xpresso software to write code for LPC17xx series of micro-controllers. I am stuck with setting the Baud rate for UART 2 am supposed to set 3360 as my baud rate. some one please help me on this issue.

Upvotes: 0

Views: 1210

Answers (2)

Clifford
Clifford

Reputation: 93476

Refer to Chapter 14 of the LPC17xx User Manual. Section 14.1 lists the general sequence for UART configuration. To set the baud rate specifically you must set the clock prescaler and the baud rate divisor.

To set the baud rate divisor set the DLAB bit in the UART CR register to unlock the baud rate registers. The baud rate divisor is split into two 8 bit values in separate 32 bit registers, so you must calculate the 16 bit divisor and then program the DLLSB and DLMSB registers separately. Section 14.4.12 describes how to calculate appropriate prescaler and divisor values with examples. Ultimately the correct values to program will depend on your PCLK frequency.

How accurately you can achieve 3360 baud will depend on your PCLK frequency; it is a somewhat non-standard rate. UARTs are fairly tolerant of baud rate error and mismatch because they synchronise their bit-sample timing on each start-bit.

Upvotes: 2

Related Questions