EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Re: How calculate the Modulation Value for UART Baud Rat e Generation

Started by Forstner, Peter June 3, 2003
Mey,
because the modulation register is an 8 bit register, we have to look at 8
bits transferred by the UART. The transmitter/receiver looks for each
transferred UART bit at the corresponding bit of the modulation register. If
the corresponding bit in the modulation register is "1", then the
transferred UART bit will get a division factor increased by 1 (bit is one
clock cycle longer). After 8 bits the transmitter/receiver restarts to look
at the first bit of the modulation register:

1) Calculate the time to send one byte (8 bits):
   9600 Baud
   1 bit takes 104us
   8 bits take 833us

2) Clock Source = 32768Hz >> Periode = 30.5us

3) Basic division factor is 32768Hz / 9600 Baud = 3.41
   So you program a division factor of 3

4) Division factor = 3 >> time per bit = 91.5us
   Each "1" in the modulation register generates for
   one transferred bit a division factor of 4 >> time / bit = 122.0us
   These "modulation bits" increase the time of one transferred
   bit by 122us - 91.5us = 30.5us

5) 8 bits with division factor of 3 are transferred within
   8 * 91.5us = 732us

6) 9600 baud required to send 8 bits on 833us

7) We are actually to fast: 833us - 732us = 101us

8) Number of "1" in the modulation register:
   101us / 30.5us = 3.3
   >> set 3 bits of modulation register to "1"

This means that you a need three "1" in the modulation register. You
should
distribute these "1"s over the 8 bits of the modulation register even,
e.g.
0x4A = 01001010. Please see also MSP430x1xx User's Guide (slau049c), page
13-16.

For the average error you should compare the send time of 8 bits:
   9600 Baud >>> 8 * 104us = 833us
division=3 and 3 modulation bits:
   5 * 91.5us + 3 * 122.0us = 823us
Average error: 1 - (823 / 833) = 1.12%

Single bit error depends on the distribution of the "1" in the
modulation
register. Here we have only one "1" in a row, but sometimes two
"0" in a
row. This calculation is not so easy and can't be done generally. You have
to look at the timing of 8 bits in a row and calculate the offset for each
bit. Then you can select the max offset.

An Excel file could do these calculations for you.

Regards
PeterF

-----Original Message-----
From: passionpersica [mailto:meysam@meys...] 
Sent: Monday, 02 June, 2003 14:34
To: msp430@msp4...
Subject: [msp430] How calculate the Modulation Value for UART Baud Rate
Generation


Hi,

i can not figure out how to calculate the Modulation Value UMCTL0.

For instance the value is UMCTL0 = 0x6B for 32768 Hz ACLK and Baude 
Rate = 2400.

TIA

Mey




.

 

">http://docs.yahoo.com/info/terms/ 


Beginning Microcontrollers with the MSP430


Memfault Beyond the Launch