Reply by Bill Knight July 28, 20072007-07-28
maxmatveev wrote:
> --- In l..., Bill Knight wrote:
>> maxmatveev wrote:
>>> Hi! I have a problem using fractional baudrate divider on
> LPC2136.
>>> When i'm not using FDR i get baudrate (for example crystal is
> 14.318
>>> MHz, PCLK = 14.318 MHz)FDR = 0x10, DLL = 0x10, DLM = 0x00.
> baudrate >>> 55930, error about 3% from 57600. Everything is seems to be ok,
> UART
>>> errors with this setting are very rare. But when i using FDR to
> set
>>> baudrate more accurately - FDR = 0xB8, DLL = 0x09, DLM = 0x00 -
>>> baudrate = 57565, error about 0.6% i get UART transfer error on
>>> almost every byte. This happens on both UARTS and with any
> baudrate
>>> from 9600 to 115200.
>>> Can anyone help me with this problem?
>>
>> Make sure your crystal is really 14.318MHz and not the baud rate
>> multiple, 14.7456MHz.
>>
>> Regards
>> -Bill Knight
>> R O SoftWare
>>
> The crystal is 14.318. Already ordered 18.432 which is baudrate
> multiple. But i want to know why fractional divider doesn't working.
>
> I will try to check real baudrate when using fractional divider with
> oscilloscope during this week.
>
Is it possible the crystal is series resonant? That will shift the
frequency off when used in a parallel resonant circuit.

-Bill

An Engineer's Guide to the LPC2100 Series

Reply by maxmatveev July 28, 20072007-07-28
--- In l..., Bill Knight wrote:
>
> maxmatveev wrote:
> > Hi! I have a problem using fractional baudrate divider on
LPC2136.
> > When i'm not using FDR i get baudrate (for example crystal is
14.318
> > MHz, PCLK = 14.318 MHz)FDR = 0x10, DLL = 0x10, DLM = 0x00.
baudrate > > 55930, error about 3% from 57600. Everything is seems to be ok,
UART
> > errors with this setting are very rare. But when i using FDR to
set
> > baudrate more accurately - FDR = 0xB8, DLL = 0x09, DLM = 0x00 -
> > baudrate = 57565, error about 0.6% i get UART transfer error on
> > almost every byte. This happens on both UARTS and with any
baudrate
> > from 9600 to 115200.
> > Can anyone help me with this problem?
> Make sure your crystal is really 14.318MHz and not the baud rate
> multiple, 14.7456MHz.
>
> Regards
> -Bill Knight
> R O SoftWare
>
The crystal is 14.318. Already ordered 18.432 which is baudrate
multiple. But i want to know why fractional divider doesn't working.

I will try to check real baudrate when using fractional divider with
oscilloscope during this week.
Reply by Tom Walsh July 28, 20072007-07-28
maxmatveev wrote:
>
> Hi! I have a problem using fractional baudrate divider on LPC2136.
> When i'm not using FDR i get baudrate (for example crystal is 14.318
> MHz, PCLK = 14.318 MHz)FDR = 0x10, DLL = 0x10, DLM = 0x00. baudrate > 55930, error about 3% from 57600. Everything is seems to be ok, UART
> errors with this setting are very rare. But when i using FDR to set
> baudrate more accurately - FDR = 0xB8, DLL = 0x09, DLM = 0x00 -
> baudrate = 57565, error about 0.6% i get UART transfer error on
> almost every byte. This happens on both UARTS and with any baudrate
> from 9600 to 115200.
> Can anyone help me with this problem?
>

I would recommend going to a 14.745600MHz crystal, if you can. That
frequency hits all the baudrates dead-on. But, you probably are using
the 14.318 somewhere else as it is a multiple of the color burst
frequency. A lot of chips used that old frequency as the crystal was
cheap (and plentiful)?

This is a perl script that I used in choosing what crystal I could use
and what accuracy that I could expect:

============ begin baudrates.pl ==============#!/usr/bin/perl
#
# this determines the degree of error between desired and actual
# baudrates on the LPC2000 processors.
#
#my $FREQ = 14745600;
my $FREQ = 14318180;
my $PLL_MUL = 4;
my $PBSD = 2;
my $CCLK = ($FREQ * $PLL_MUL);
my $PCLK = ($CCLK / $PBSD);
my @commonRates (300,600,1200,2400,4800,9600,19200,38400,57600,115200,230400);

#define UART_BAUD(baud) (uint16_t)((PCLK / ((baud) * 16.0)) + 0.5)

sub calcBaud {
my $desired = $_[0];
my $divisor = int(($PCLK / ($desired*16.0))+ 0.5);
my $actual = int(($PCLK / (16*$divisor)) * 1000) / 1000;
my $error = int((($actual - $desired) / $desired) * 1000000) / 10000;
print "divisor: ${divisor} desired: ${desired} ".
"actual: ${actual} error: ${error}%\n";
}

while (@commonRates) {
calcBaud (shift(@commonRates));
}

============ snip ======================
These are the calculations that I get from a 14.318180MHz crystal used
for an LPC2xxx processor:

============== begin rates ==============divisor: 5966 desired: 300 actual: 299.995 error: -0.0016%
divisor: 2983 desired: 600 actual: 599.99 error: -0.0016%
divisor: 1491 desired: 1200 actual: 1200.383 error: 0.0319%
divisor: 746 desired: 2400 actual: 2399.158 error: -0.035%
divisor: 373 desired: 4800 actual: 4798.317 error: -0.035%
divisor: 186 desired: 9600 actual: 9622.432 error: 0.2336%
divisor: 93 desired: 19200 actual: 19244.865 error: 0.2336%
divisor: 47 desired: 38400 actual: 38080.265 error: -0.8326%
divisor: 31 desired: 57600 actual: 57734.596 error: 0.2336%
divisor: 16 desired: 115200 actual: 111860.781 error: -2.8986%
divisor: 8 desired: 230400 actual: 223721.562 error: -2.8986%
============== snip ===================
I would not use the 115200 or 230400 rates as they are above a 2%
deviation from the desired baudrate. IIRC, 2% is the limit for baudrate
speed/bit-timing error.

TomW

--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------
Reply by Bill Knight July 28, 20072007-07-28
maxmatveev wrote:
> Hi! I have a problem using fractional baudrate divider on LPC2136.
> When i'm not using FDR i get baudrate (for example crystal is 14.318
> MHz, PCLK = 14.318 MHz)FDR = 0x10, DLL = 0x10, DLM = 0x00. baudrate > 55930, error about 3% from 57600. Everything is seems to be ok, UART
> errors with this setting are very rare. But when i using FDR to set
> baudrate more accurately - FDR = 0xB8, DLL = 0x09, DLM = 0x00 -
> baudrate = 57565, error about 0.6% i get UART transfer error on
> almost every byte. This happens on both UARTS and with any baudrate
> from 9600 to 115200.
> Can anyone help me with this problem?
Make sure your crystal is really 14.318MHz and not the baud rate
multiple, 14.7456MHz.

Regards
-Bill Knight
R O SoftWare
Reply by maxmatveev July 28, 20072007-07-28
Hi! I have a problem using fractional baudrate divider on LPC2136.
When i'm not using FDR i get baudrate (for example crystal is 14.318
MHz, PCLK = 14.318 MHz)FDR = 0x10, DLL = 0x10, DLM = 0x00. baudrate 55930, error about 3% from 57600. Everything is seems to be ok, UART
errors with this setting are very rare. But when i using FDR to set
baudrate more accurately - FDR = 0xB8, DLL = 0x09, DLM = 0x00 -
baudrate = 57565, error about 0.6% i get UART transfer error on
almost every byte. This happens on both UARTS and with any baudrate
from 9600 to 115200.
Can anyone help me with this problem?