Em Qui 02 Mar 2006 12:04, Iván Cayón escreveu: > Hi !! > I'm trying to send data with the UART at 115200 bps with a Xtal of 10 Mhz > and the PC doesn't receive the data correctly. Is the baud rate limited > with this equation? > > ratemax = PCLK / (16 x (2 + databits + paritybits + stopbits) > > if this is correct then I can't get this baudrate with 10 Mhz xtal > > Regards, > > Ivan Are you using PLL? I am using right now an LPC2106 with 10MHz crystal. To calculate the baudrate, you must first pick you pclk. For example, I am using 50MHz (pll * 5) and pclk = 1 (the pclk is the same as the core clock). So, if I have a 50MHz, first divide it by 16. I get: 3,125,000 and at that frequency thats the clock that UART uses. So, to calculate the dividers, divide that clock by the desired baudrate, which at 115,200 gives me: 27,1267 Note that I have 0,1267 as decimal error on my divider, because the divider accpets only integer numbers. If I made the other side calculation, dividing 3,125,000 by 27, I get 115741 bps which is the speed my LPC will talk. If, for example, I make the pll running at 60MHz, my divider is 32,5521 Note how big is my decimal error, is practicaly the worst case, where the error resides in the middle betweem 0 and 1. If I use the divider as 33, my UART speed is 113636 bps. Very bad, huh? So, to use 10MHz crystal, check this before. The lesser the decimal error, the best your serial communication will be. For example, with the pclk at 10MHz, the UART speed will be 125000bps. Try to calculate it.
Message
Re: [lpc2000] UART baudrate
2006-03-02 by Xtian Xultz
Attachments
- No local attachments were found for this message.