EmbeddedRelated.com
Forums

uart on DCO clk.

Started by Martijn Broens September 22, 2003
Hi Bruce, Steve and others,
 
Could you guys help me out? As you know I'm trying to build a uart
running on the DCO ? I've got I it running but there's one small thing
I
don't get.
 
For 9600 Bd II use the following settings:
/*
 * 9600 BD settings
*/
#ifdef __9600BD__                                // tested and OK
#define  Bitime_5           0x40                 // 0.5 bit length +
small adj.
#define  Bitime              0x80                 // 104us 
#define DELTA              300                   // 9600BD => target DCO
= DELTA*(32768) = 9830400 
#endif
 
How do i determine the DELTA, what does it mean?? (used in Set_DCO())
And if I calculate the Bittime (1/9600) than that gives me 104us but how
on earth is that related to 0x80????
 
Any comments / suggestions are more than welcom
thanks Martijn.
 





Beginning Microcontrollers with the MSP430

The Delta is, as the comment says, the desired DCO rate divided by 
32768.  Not the baud rate, which is derived from the DCO.  In the 
example code, the DCO was set to 3.58MHz, and the 19.2kbps UART was 
derived from that (by dividing it by 186).  Delta is the amount we 
expect to capture in the capture/compare, to keep our DCO at or 
around 32768*DELTA (we count DELTA ticks of the 32K clock).

--- In msp430@msp4..., "Martijn Broens" <martijn@a...> wrote:
> Hi Bruce, Steve and others,
>  
> Could you guys help me out? As you know I'm trying to build a uart
> running on the DCO ? I've got I it running but there's one small 
thing I
> don't get.
>  
> For 9600 Bd II use the following settings:
> /*
>  * 9600 BD settings
> */
> #ifdef __9600BD__                                // tested and OK
> #define  Bitime_5           0x40                 // 0.5 bit length 
+
> small adj.
> #define  Bitime              0x80                 // 104us 
> #define DELTA              300                   // 9600BD => 
target DCO
> = DELTA*(32768) = 9830400 
> #endif
>  
> How do i determine the DELTA, what does it mean?? (used in Set_DCO
())
> And if I calculate the Bittime (1/9600) than that
gives me 104us 
but how
> on earth is that related to 0x80????
>  
> Any comments / suggestions are more than welcom
> thanks Martijn.
>  
> 
> 
> 


Steve, thanks for the reply, sorry saw it but didn't get it.
 
Just so I don't get it wrong: DELTA sets the DCO clk freq. 
 
But than how do I get the Bittime values? 
And does ACLK need to be deived  by 8? Or can it also be just LFXT ie
32768Hz?
 
Thanks martijn
 
  _____  

From: SBurck [mailto:sburck@sbur...] 
Sent: maandag 22 september 2003 9:21
To: msp430@msp4...
Subject: [msp430] Re: uart on DCO clk.
 
The Delta is, as the comment says, the desired DCO rate divided by 
32768.  Not the baud rate, which is derived from the DCO.  In the 
example code, the DCO was set to 3.58MHz, and the 19.2kbps UART was 
derived from that (by dividing it by 186).  Delta is the amount we 
expect to capture in the capture/compare, to keep our DCO at or 
around 32768*DELTA (we count DELTA ticks of the 32K clock).

--- In msp430@msp4..., "Martijn Broens" <martijn@a...> wrote:
> Hi Bruce, Steve and others,
>  
> Could you guys help me out? As you know I'm trying to build a uart
> running on the DCO ? I've got I it running but there's one small 
thing I
> don't get.
>  
> For 9600 Bd II use the following settings:
> /*
>  * 9600 BD settings
> */
> #ifdef __9600BD__                                // tested and OK
> #define  Bitime_5           0x40                 // 0.5 bit length 
+
> small adj.
> #define  Bitime              0x80                 // 104us 
> #define DELTA              300                   // 9600BD => 
target DCO
> = DELTA*(32768) = 9830400 
> #endif
>  
> How do i determine the DELTA, what does it mean?? (used in Set_DCO
())
> And if I calculate the Bittime (1/9600) than that
gives me 104us 
but how
> on earth is that related to 0x80????
>  
> Any comments / suggestions are more than welcom
> thanks Martijn.
>  
> 
> 
> 





click here
<http://rd.yahoo.com/M4081.3897168.5135684.1261774/D=egroupweb/S05
005378:HM/A32161/R=0/SIGp5b9ris/*http:/www.ediets.com/start.cfm?co
de0509&media=atkins> 
 
<http://us.adserver.yahoo.com/l?M4081.3897168.5135684.1261774/D=egrou
pmail/S=:HM/A32161/rand6553002> 

.



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





Martijn -

The line: 

UTCTL0 = SSEL1 

makes the UART0 clock use the SMCLK.  SMCLK is selected as the DCO, 
which is nominally running at 3.58MHz.  UBR00 is set to 0xBA, which 
divides the 3.58MHz by 0xBA to result in 19247.31 bps, which is less 
than 0.0025% off of 19200, good enough for the baud rate generation.

The ACLK/8 is being used to compare it to SMCLK/8, which is what the 
timer A capture is set to.  If you set ACLK to 32K, then adjust 
TACTL accordingly.  I think this should work.

Steve

--- In msp430@msp4..., "Martijn Broens" <martijn@a...> wrote:
> Steve, thanks for the reply, sorry saw it but
didn't get it.
>  
> Just so I don't get it wrong: DELTA sets the DCO clk freq. 
>  
> But than how do I get the Bittime values? 
> And does ACLK need to be deived  by 8? Or can it also be just LFXT 
ie
> 32768Hz?
>  
> Thanks martijn
>  
>   _____  
> 
> From: SBurck [mailto:sburck@n...] 
> Sent: maandag 22 september 2003 9:21
> To: msp430@msp4...
> Subject: [msp430] Re: uart on DCO clk.
>  
> The Delta is, as the comment says, the desired DCO rate divided by 
> 32768.  Not the baud rate, which is derived from the DCO.  In the 
> example code, the DCO was set to 3.58MHz, and the 19.2kbps UART 
was 
> derived from that (by dividing it by 186).  Delta
is the amount we 
> expect to capture in the capture/compare, to keep our DCO at or 
> around 32768*DELTA (we count DELTA ticks of the 32K clock).
> 
> --- In msp430@msp4..., "Martijn Broens" <martijn@a...> 
wrote:
> > Hi Bruce, Steve and others,
> >  
> > Could you guys help me out? As you know I'm trying to build a 
uart
> > running on the DCO ? I've got I it
running but there's one small 
> thing I
> > don't get.
> >  
> > For 9600 Bd II use the following settings:
> > /*
> >  * 9600 BD settings
> > */
> > #ifdef __9600BD__                                // tested and OK
> > #define  Bitime_5           0x40                 // 0.5 bit 
length 
> +
> > small adj.
> > #define  Bitime              0x80                 // 104us 
> > #define DELTA              300                   // 9600BD => 
> target DCO
> > = DELTA*(32768) = 9830400 
> > #endif
> >  
> > How do i determine the DELTA, what does it mean?? (used in 
Set_DCO
> ())
> > And if I calculate the Bittime (1/9600) than that gives me 104us 
> but how
> > on earth is that related to 0x80????
> >  
> > Any comments / suggestions are more than welcom
> > thanks Martijn.
> >  
> > 
> > 
> > 
> 
> 
> 
> 
> 
> click here
> 
<http://rd.yahoo.com/M4081.3897168.5135684.1261774/D=egroupweb/S=1
705
> 
005378:HM/A32161/R=0/SIGp5b9ris/*http:/www.ediets.com/start.cfm
?co
> de0509&media=atkins> 
>  
> <http://us.adserver.yahoo.com/l?
M4081.3897168.5135684.1261774/D=egrou
> pmail/S=:HM/A32161/rand6553002> 
> 
> .
> 
> 
> 
> ">http://docs.yahoo.com/info/terms/> . 
> 
> 
>