Dear All,
I have tested the Equation for calculate Baud rate but I have found a problem with the example of the Manual LPC23XX Rev.1 11 March 2008 Page 433.
These are the rows that I took from MANUAL LPC23XX Rev.1:
4.17.1.2 Example 2: PCLK = 12 MHz, BR = 115200 According to the the provided algorithm DLest = PCLK/(16 x BR) = 12 MHz / (16 x 115200) = 6.51. This DLest is not an integer number and the next step is to estimate the FR parameter. Using an initial estimate of FRest = 1.5 a new DLest = 4 is calculated and FRest is recalculated as FRest = 1.628. Since FRest = 1.628 is within the specified range of 1.1 and 1.9, DIVADDVAL and MULVAL values can be obtained from the attached look-up table. The closest value for FRest = 1.628 in the look-up Table 17â€"372 is FR = 1.625. It is equivalent to DIVADDVAL = 5 and MULVAL = 8. Based on these findings, the suggested UART setup would be: DLM = 0, DLL = 4, DIVADDVAL = 5, and MULVAL = 8. According to Equation 17â€"12 UART’s is 115384. This rate has a relative error of 0.16% from the originally specified 115200.
This is my code:
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U1DLM = 0x0; /* Divisor Latch LSB */ U1DLL = 0x4; /* Divisor Latch MSB */ U1FDR = 0x85; /* Fractional Divider Register */ U1LCR |= 0x03; /* DLAB = 0 */ U1FCR = 0x07; /* Enable and reset TX and RX FIFO. */
Is it OK?
Thanks
Michele