EmbeddedRelated.com
Forums

9600 baud UART & 32kHz

Started by bergy50us May 3, 2004
I want to use a UART at 9600 baud with a 32kHz crystal on my system.
My question is two parts:
1)has anyone done this in production? (the bits timing errors peak at
well over 10% - do connecting systems have trouble with that?)
2)Why does TI recommend $4A in the modulation register?  $52 seems to
produce less error.

I've already sync'd the DCO to the 32kHz and I know that can work. 
But I don't want to do it that way.

Thanks,  Gary


Beginning Microcontrollers with the MSP430

At 16.23 03/05/2004, you wrote:
>I want to use a UART at 9600 baud with a 32kHz
crystal on my system.
>My question is two parts:
>1)has anyone done this in production? (the bits timing errors peak at
>well over 10% - do connecting systems have trouble with that?)
>2)Why does TI recommend $4A in the modulation register?  $52 seems to
>produce less error.
>
>I've already sync'd the DCO to the 32kHz and I know that can work.
>But I don't want to do it that way.
>
>Thanks,  Gary

Yes, I did it, in production. It works. Cannot remember now if I used the 
$4A, or $49 possibly , not $52.
I used the number suggested by the baud rate calculator, a small program 
you can find trhough google.
I did have to tweak a little with the capacitors of the Xtal in a few boards.
We keep producing these devices and people is satisfied.
On the other side, we never used the dco as a baud rate clock source, can't

say if it is a good idea or not.
That's all
Regards
Antonio



 --- bergy50us <forthprgrmr@fort...> wrote: > I
want to use a UART at 9600 baud with a 32kHz
> crystal on my system.
> My question is two parts:
> 1)has anyone done this in production? (the bits
> timing errors peak at
> well over 10% - do connecting systems have trouble
> with that?)
> 2)Why does TI recommend $4A in the modulation
> register?  $52 seems to
> produce less error.
> 
> I've already sync'd the DCO to the 32kHz and I know
> that can work. 
> But I don't want to do it that way.
> 
> Thanks,  Gary
> 
> 
> 
I have some thousands of units out in the wild that
use a 32768kHz Xtal to generate 9600 baud serial
comms.  I have only had trouble interfacing to one
external controller unit.  It turned out that this was
based on an embedded pc-board running a rommed version
of DOS.  This board did not produce serial output at
9600 baud - it was around 9300 which was too far off
for reliable reception.

On your second point, the two values that you give
will result in exactly the same behaviour by the UART.
 The modulation register makes the UART extend the bit
period by one clock each time the bit in the
modulation register is a 1.  The values 0x4A and 0x52
give the sequences:-
 0x4A                   0x52
short                    :
long                     :
short                    :
short                   short 
long                    long
short                   short
long                    long
short                   short
short <start seq again> short
long                    long    
short                   short 
short                   short <start again> 
long                    long
short                   short
  :                      :
  :                      :

Spot the difference ;-)

Hope this helps

Ian

http://www.satamatics.com


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

--- In msp430@msp4..., Ian Okey <ian_okey@y...> wrote:
>  --- bergy50us <forthprgrmr@h...> wrote:
> I
> want to use a UART at 9600 baud with a 32kHz
> > crystal on my system.
> > My question is two parts:
> > 1)has anyone done this in production? (the bits
> > timing errors peak at
> > well over 10% - do connecting systems have trouble
> > with that?)
> > 2)Why does TI recommend $4A in the modulation
> > register?  $52 seems to
> > produce less error.
> > 
> > I've already sync'd the DCO to the 32kHz and I know
> > that can work. 
> > But I don't want to do it that way.
> > 
> > Thanks,  Gary
> > 
> > 
> > 
> I have some thousands of units out in the wild that
> use a 32768kHz Xtal to generate 9600 baud serial
> comms.  I have only had trouble interfacing to one
> external controller unit.  It turned out that this was
> based on an embedded pc-board running a rommed version
> of DOS.  This board did not produce serial output at
> 9600 baud - it was around 9300 which was too far off
> for reliable reception.

We spec'd in a 38.400 kHz crystal for a device that demands reliable 
communications.  The cost is usually within a few pennies of a 
32.768K crystal, it works fine with the LF oscillator, and we KNOW 
our baud rate is correct, with no modulation required. They are easy 
to obtain, as it is apparently a commonly used frequency in pagers 
(remember those?).  All my system timing is derived from some macros 
that use the value of a #defined symbol, XTAL_FREQUENCY, so it's easy 
to change to a 32KHz clock if necessary (like using an eval board).

--Gene



--- In msp430@msp4..., "reallygene" <gene.berkowitz@p...> 
wrote:
> --- In msp430@msp4..., Ian Okey <ian_okey@y...> wrote:
> >  --- bergy50us <forthprgrmr@h...> wrote: > I
> > want to use a UART at 9600 baud with a 32kHz
> > > crystal on my system.
> > > My question is two parts:
> > > 1)has anyone done this in production? (the bits
> > > timing errors peak at
> > > well over 10% - do connecting systems have trouble
> > > with that?)
> > > 2)Why does TI recommend $4A in the modulation
> > > register?  $52 seems to
> > > produce less error.
> > > 
> > > I've already sync'd the DCO to the 32kHz and I know
> > > that can work. 
> > > But I don't want to do it that way.
> > > 
> > > Thanks,  Gary
> > > 
> > > 
> > > 
> > I have some thousands of units out in the wild that
> > use a 32768kHz Xtal to generate 9600 baud serial
> > comms.  I have only had trouble interfacing to one
> > external controller unit.  It turned out that this was
> > based on an embedded pc-board running a rommed version
> > of DOS.  This board did not produce serial output at
> > 9600 baud - it was around 9300 which was too far off
> > for reliable reception.
> 
> We spec'd in a 38.400 kHz crystal for a device that demands 
reliable 
> communications.  The cost is usually within a few
pennies of a 
> 32.768K crystal, it works fine with the LF oscillator, and we KNOW 
> our baud rate is correct, with no modulation required. They are 
easy 
> to obtain, as it is apparently a commonly used
frequency in pagers 
> (remember those?).  All my system timing is derived from some 
macros 
> that use the value of a #defined symbol,
XTAL_FREQUENCY, so it's 
easy 
> to change to a 32KHz clock if necessary (like
using an eval board).
> 
> --Gene

Hi Gene,

I'm looking at the moment, if the MSP430 is the right processor 
family for us. We need a low power processor for battery-powered 
security devices (electronic lock). Communication is one important 
thing at this application. 
With this 38.400 kHz crystal, what is the maximum baudrate? 19.200 ?

Thanks,
Chris



Hi,

> With this 38.400 kHz crystal, what is the maximum
baudrate? 19.200 ?

It depends on the receiver at the other end of the line.
With usual 32768 Hz clock quartz and a serial port of a PC you can use 9600 but
with some uarts, e. g. one of the samsung s3c2410 uarts, you get receive errors
because this mc is specified for max. 3 % error and the msp has much more at
9600 with a ususal 32768 Hz quartz (
http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?clock2768&baud00&submitculate
).
With a 38400 Hz quartz you have no problem with errors up 38400 (
http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?clock8400&baud8400&submitculate
) but with such a quartz you would have a WDT-ISR frequency of 1.121875 (*2^n)
Hz which would make implementing a real time clock complex.

Rolf



--- In msp430@msp4..., "c_lelie" <chris@l...> wrote:
> --- In msp430@msp4..., "reallygene"
<gene.berkowitz@p...> 
> wrote:
> > --- In msp430@msp4..., Ian Okey <ian_okey@y...> wrote:
> > >  --- bergy50us <forthprgrmr@h...> wrote: > I
> > > want to use a UART at 9600 baud with a 32kHz
> > > > crystal on my system.
> > > > My question is two parts:
> > > > 1)has anyone done this in production? (the bits
> > > > timing errors peak at
> > > > well over 10% - do connecting systems have trouble
> > > > with that?)
> > > > 2)Why does TI recommend $4A in the modulation
> > > > register?  $52 seems to
> > > > produce less error.
> > > > 
> > > > I've already sync'd the DCO to the 32kHz and I
know
> > > > that can work. 
> > > > But I don't want to do it that way.
> > > > 
> > > > Thanks,  Gary
> > > > 
> > > > 
> > > > 
> > > I have some thousands of units out in the wild that
> > > use a 32768kHz Xtal to generate 9600 baud serial
> > > comms.  I have only had trouble interfacing to one
> > > external controller unit.  It turned out that this was
> > > based on an embedded pc-board running a rommed version
> > > of DOS.  This board did not produce serial output at
> > > 9600 baud - it was around 9300 which was too far off
> > > for reliable reception.
> > 
> > We spec'd in a 38.400 kHz crystal for a device that demands 
> reliable 
> > communications.  The cost is usually within a few pennies of a 
> > 32.768K crystal, it works fine with the LF oscillator, and we 
KNOW 
> > our baud rate is correct, with no modulation
required. They are 
> easy 
> > to obtain, as it is apparently a commonly used frequency in 
pagers 
> > (remember those?).  All my system timing is
derived from some 
> macros 
> > that use the value of a #defined symbol, XTAL_FREQUENCY, so it's 
> easy 
> > to change to a 32KHz clock if necessary (like using an eval 
board).
> > 
> > --Gene
> 
> Hi Gene,
> 
> I'm looking at the moment, if the MSP430 is the right processor 
> family for us. We need a low power processor for battery-powered 
> security devices (electronic lock). Communication is one important 
> thing at this application. 
> With this 38.400 kHz crystal, what is the maximum baudrate? 19.200 ?
> 
> Thanks,
> Chris

Max baud rate is 38,400 bps (UART divisor set to 1).

--Gene



--- In msp430@msp4..., <rolf.freitag@e...> wrote:
> Hi,
> 
> > With this 38.400 kHz crystal, what is the maximum baudrate? 
19.200 ?
> 
> It depends on the receiver at the other end of the line.
> With usual 32768 Hz clock quartz and a serial port of a PC you can 
use 9600 but with some uarts, e. g. one of the samsung s3c2410 uarts, 
you get receive errors because this mc is specified for max. 3 % 
error and the msp has much more at 9600 with a ususal 32768 Hz quartz 
( http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?
clock2768&baud00&submitculate ).
> With a 38400 Hz quartz you have no problem with
errors up 38400 ( 
http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?
clock8400&baud8400&submitculate ) but with such a quartz you 
would have a WDT-ISR frequency of 1.121875 (*2^n) Hz which would make 
implementing a real time clock complex.
> 
> Rolf

In our application, the timing accuracy only has to be relative, and 
using the 38400 xtal, it's good enough.  The communication is 
critical, however, and we had trouble using the 32.767 kHz derived 
rates with some equipment.

--Gene




> Max baud rate is 38,400 bps (UART divisor set to
1).
> 
> --Gene

You should always keep your Baud divider at minimum
div / 3.
Reason is that the ASYNC part of USART samples just before
bit center, on center, and just after.

Funny things will happen if you use a BR < 3, I haven't tried it however
but I don't expect it to work very well !

-- Kris




rolf.freitag@rolf... wrote:Hi,

> With this 38.400 kHz crystal, what is the maximum
baudrate? 19.200 ?

It depends on the receiver at the other end of the line.
With usual 32768 Hz clock quartz and a serial port of a PC you can use 9600 but
with some uarts, e. g. one of the samsung s3c2410 uarts, you get receive errors
because this mc is specified for max. 3 % error and the msp has much more at
9600 with a ususal 32768 Hz quartz (
http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?clock2768&baud00&submitculate
).
With a 38400 Hz quartz you have no problem with errors up 38400 (
http://mspgcc.sourceforge.net/cgi-bin/msp-uart.pl?clock8400&baud8400&submitculate
) but with such a quartz you would have a WDT-ISR frequency of 1.121875 (*2^n)
Hz which would make implementing a real time clock complex.

Rolf




.





---------------------------------
. 



		
---------------------------------
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs