EmbeddedRelated.com
Forums

MSP430 Clock Configuration

Started by hc08jb8 September 3, 2004
Hello Matt

Indeed, this conversaton might benefit some newbie like me :)

>     Answer to Question 2:  Yes the DCO is preset
to
> 800kHz.

Can this value be changed? What could be the max value?

> > >     If you are looking to get a
2MHz-4MHz from a
> > > 32kHz clock then I suggest
> > > using the DCO or change your crystal. 

If I add a 2Mhz crystal to XIN/XOUT, it would give me ACLK = 2Mhz 
direct upon startup?

For now I would be using the MSP430F1xx, esp the MSP430F1232 mainly 
due to the SPI pheripheral.

Cheers
Jay

>--- Matt Sabino <msabino@msab...> wrote:
>
> Jay,
>     The ACLK should be 32kHz from that setup without
> any other code.
> 
>     Answer to Question 1:  Yes DCO is the internal
> crystal or Digitally
> Controlled Oscillator.  Now as far as stabilizing
> the DCO, if you were
> buying the MSP430F4xx series, they would have a
> Frequency Lock Loop built in
> automatically.  Unfortunately the MSP430F1xx series
> DO NOT have that.  You
> can stabilize the DCO by creating a software FLL by
> referencing between the
> DCO and your 32kHz crystal.
> 
>     Answer to Question 2:  Yes the DCO is preset to
> 800kHz.
> 
> No Problems, Im just glad I can help.  We might want
> to start moving this
> conversation back to the group so that other people
> can gain some insight
> from your questions.
> 
> HTH,
> 
> 
> Matt Sabino
> Computer Engineer
> Airtronic Services, Inc.
> 
> 
> 
> ----- Original Message ----- 
> From: "68HC 08" <hc08jb8@hc08...>
> To: "Matt Sabino" <msabino@msab...>
> Sent: Friday, September 03, 2004 2:09 PM
> Subject: Re: Dataflash code ported?
> 
> 
> > Hi Matt
> >
> > >If you are connecting the 32kHz crystal to XIN
> and
> > >XOUT then you can access the clock immediately on
> > ACLK
> >
> > Yep, this is how I have the watch crystal
> connected,
> > without any code or setup, ACLK would be 32Khz or
> some
> > other value?
> >
> > 1.) DCO is like the internal crystal (not so
> accurate)
> > kind right? Does adding the 32Khz to XIN/XOUT have
> any
> > effcct on the DCO itself, like stabilizing it?
> >
> > 2.) Without any external crystal the DCO is
> 800kHz?
> >
> > I appreciate your valuable time.
> >
> > Jay
> >
> > --- Matt Sabino <msabino@msab...> wrote:
> >
> > > Hi Jay,
> > >     Depending on how you set up SELS and SELM,
> you
> > > can get your clock from a
> > > number of points.  The major point is that the
> Main
> > > clock (MCLK) is for your
> > > code execution, the Sub-System Clock (SMCLK) is
> for
> > > all of your I/O and
> > > peripherals, such as the USART, and the ACLK is
> for
> > > your TimerA/B.  All of
> > > the peripherals can be changed to run off
> different
> > > clocks if you set them
> > > up that way.
> > >     If you are looking to get a 2MHz-4MHz from a
> > > 32kHz clock then I suggest
> > > using the DCO or change your crystal.  The
> downfall
> > > with the DCO is that it
> > > isnt accurate and frequently needs to be updated
> to
> > > maintain that frequency.
> > > The DCO is just an RC circuit, IIRC, and
> therefore
> > > changes in voltage,
> > > temperature, etc will affect its frequency.
> > >     If you are connecting the 32kHz crystal to
> XIN
> > > and XOUT then you can
> > > access the clock immediately on ACLK.  Now
> whether
> > > you choose to use the DCO
> > > or the crystal is all up to you and your
> application
> > > and what constraints
> > > you need to meet.
> > >
> > > HTH,
> > >
> > >
> > > Matt Sabino
> > > Computer Engineer
> > > Airtronic Services, Inc.
> > >



Beginning Microcontrollers with the MSP430

Jay,
    You can change the value of the DCO, but only up to 5MHz if youre only using
the internal resistors.  If you put an external resistor on the Rosc pin then it
can go faster.
    Yes your ACLK would be 2MHz on startup, if you connected a 2MHz chip to
XIN/XOUT.  You can put ACLK out on pin 8, P2.0/ACLK/A0, then you can scope it
see that youre actually getting the 2MHz out.  Just write this:
    P2DIR |= 0x01; //P2.0 set as output

    P2SEL |= 0x01; //ACLK set to output


HTH,



Matt Sabino
Computer Engineer
Airtronic Services, Inc.




  ----- Original Message ----- 
  From: hc08jb8 
  To: msp430@msp4... 
  Sent: Friday, September 03, 2004 2:37 PM
  Subject: [msp430] MSP430 Clock Configuration


  Hello Matt

  Indeed, this conversaton might benefit some newbie like me :)

  >     Answer to Question 2:  Yes the DCO is preset to
  > 800kHz.

  Can this value be changed? What could be the max value?

  > > >     If you are looking to get a 2MHz-4MHz from a
  > > > 32kHz clock then I suggest
  > > > using the DCO or change your crystal. 

  If I add a 2Mhz crystal to XIN/XOUT, it would give me ACLK = 2Mhz 
  direct upon startup?

  For now I would be using the MSP430F1xx, esp the MSP430F1232 mainly 
  due to the SPI pheripheral.

  Cheers
  Jay

  >--- Matt Sabino <msabino@msab...> wrote:
  >
  > Jay,
  >     The ACLK should be 32kHz from that setup without
  > any other code.
  > 
  >     Answer to Question 1:  Yes DCO is the internal
  > crystal or Digitally
  > Controlled Oscillator.  Now as far as stabilizing
  > the DCO, if you were
  > buying the MSP430F4xx series, they would have a
  > Frequency Lock Loop built in
  > automatically.  Unfortunately the MSP430F1xx series
  > DO NOT have that.  You
  > can stabilize the DCO by creating a software FLL by
  > referencing between the
  > DCO and your 32kHz crystal.
  > 
  >     Answer to Question 2:  Yes the DCO is preset to
  > 800kHz.
  > 
  > No Problems, Im just glad I can help.  We might want
  > to start moving this
  > conversation back to the group so that other people
  > can gain some insight
  > from your questions.
  > 
  > HTH,
  > 
  > 
  > Matt Sabino
  > Computer Engineer
  > Airtronic Services, Inc.
  > 
  > 
  > 
  > ----- Original Message ----- 
  > From: "68HC 08" <hc08jb8@hc08...>
  > To: "Matt Sabino" <msabino@msab...>
  > Sent: Friday, September 03, 2004 2:09 PM
  > Subject: Re: Dataflash code ported?
  > 
  > 
  > > Hi Matt
  > >
  > > >If you are connecting the 32kHz crystal to XIN
  > and
  > > >XOUT then you can access the clock immediately on
  > > ACLK
  > >
  > > Yep, this is how I have the watch crystal
  > connected,
  > > without any code or setup, ACLK would be 32Khz or
  > some
  > > other value?
  > >
  > > 1.) DCO is like the internal crystal (not so
  > accurate)
  > > kind right? Does adding the 32Khz to XIN/XOUT have
  > any
  > > effcct on the DCO itself, like stabilizing it?
  > >
  > > 2.) Without any external crystal the DCO is
  > 800kHz?
  > >
  > > I appreciate your valuable time.
  > >
  > > Jay
  > >
  > > --- Matt Sabino <msabino@msab...> wrote:
  > >
  > > > Hi Jay,
  > > >     Depending on how you set up SELS and SELM,
  > you
  > > > can get your clock from a
  > > > number of points.  The major point is that the
  > Main
  > > > clock (MCLK) is for your
  > > > code execution, the Sub-System Clock (SMCLK) is
  > for
  > > > all of your I/O and
  > > > peripherals, such as the USART, and the ACLK is
  > for
  > > > your TimerA/B.  All of
  > > > the peripherals can be changed to run off
  > different
  > > > clocks if you set them
  > > > up that way.
  > > >     If you are looking to get a 2MHz-4MHz from a
  > > > 32kHz clock then I suggest
  > > > using the DCO or change your crystal.  The
  > downfall
  > > > with the DCO is that it
  > > > isnt accurate and frequently needs to be updated
  > to
  > > > maintain that frequency.
  > > > The DCO is just an RC circuit, IIRC, and
  > therefore
  > > > changes in voltage,
  > > > temperature, etc will affect its frequency.
  > > >     If you are connecting the 32kHz crystal to
  > XIN
  > > > and XOUT then you can
  > > > access the clock immediately on ACLK.  Now
  > whether
  > > > you choose to use the DCO
  > > > or the crystal is all up to you and your
  > application
  > > > and what constraints
  > > > you need to meet.
  > > >
  > > > HTH,
  > > >
  > > >
  > > > Matt Sabino
  > > > Computer Engineer
  > > > Airtronic Services, Inc.
  > > >




  .




        
             
       
       


------
  . 



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.749 / Virus Database: 501 - Release Date: 9/1/2004




A word of caution. The crystal oscillator does not immediately start 
running at power up. You must firts initialise it and wait for it to 
become stable before you can use it.

Al

Matt Sabino wrote:
> Jay,
>     You can change the value of the DCO, but only up to 5MHz if youre only
using the internal resistors.  If you put an external resistor on the Rosc pin
then it can go faster.
>     Yes your ACLK would be 2MHz on startup, if you connected a 2MHz chip to
XIN/XOUT.  You can put ACLK out on pin 8, P2.0/ACLK/A0, then you can scope it
see that youre actually getting the 2MHz out.  Just write this:
>     P2DIR |= 0x01; //P2.0 set as output
> 
>     P2SEL |= 0x01; //ACLK set to output
> 
> 
> HTH,
> 
> 
> 
> Matt Sabino
> Computer Engineer
> Airtronic Services, Inc.
> 
> 
> 
> 
>   ----- Original Message ----- 
>   From: hc08jb8 
>   To: msp430@msp4... 
>   Sent: Friday, September 03, 2004 2:37 PM
>   Subject: [msp430] MSP430 Clock Configuration
> 
> 
>   Hello Matt
> 
>   Indeed, this conversaton might benefit some newbie like me :)
> 
>   >     Answer to Question 2:  Yes the DCO is preset to
>   > 800kHz.
> 
>   Can this value be changed? What could be the max value?
> 
>   > > >     If you are looking to get a 2MHz-4MHz from a
>   > > > 32kHz clock then I suggest
>   > > > using the DCO or change your crystal. 
> 
>   If I add a 2Mhz crystal to XIN/XOUT, it would give me ACLK = 2Mhz 
>   direct upon startup?
> 
>   For now I would be using the MSP430F1xx, esp the MSP430F1232 mainly 
>   due to the SPI pheripheral.
> 
>   Cheers
>   Jay
> 
>   >--- Matt Sabino <msabino@msab...> wrote:
>   >
>   > Jay,
>   >     The ACLK should be 32kHz from that setup without
>   > any other code.
>   > 
>   >     Answer to Question 1:  Yes DCO is the internal
>   > crystal or Digitally
>   > Controlled Oscillator.  Now as far as stabilizing
>   > the DCO, if you were
>   > buying the MSP430F4xx series, they would have a
>   > Frequency Lock Loop built in
>   > automatically.  Unfortunately the MSP430F1xx series
>   > DO NOT have that.  You
>   > can stabilize the DCO by creating a software FLL by
>   > referencing between the
>   > DCO and your 32kHz crystal.
>   > 
>   >     Answer to Question 2:  Yes the DCO is preset to
>   > 800kHz.
>   > 
>   > No Problems, Im just glad I can help.  We might want
>   > to start moving this
>   > conversation back to the group so that other people
>   > can gain some insight
>   > from your questions.
>   > 
>   > HTH,
>   > 
>   > 
>   > Matt Sabino
>   > Computer Engineer
>   > Airtronic Services, Inc.
>   > 
>   > 
>   > 
>   > ----- Original Message ----- 
>   > From: "68HC 08" <hc08jb8@hc08...>
>   > To: "Matt Sabino" <msabino@msab...>
>   > Sent: Friday, September 03, 2004 2:09 PM
>   > Subject: Re: Dataflash code ported?
>   > 
>   > 
>   > > Hi Matt
>   > >
>   > > >If you are connecting the 32kHz crystal to XIN
>   > and
>   > > >XOUT then you can access the clock immediately on
>   > > ACLK
>   > >
>   > > Yep, this is how I have the watch crystal
>   > connected,
>   > > without any code or setup, ACLK would be 32Khz or
>   > some
>   > > other value?
>   > >
>   > > 1.) DCO is like the internal crystal (not so
>   > accurate)
>   > > kind right? Does adding the 32Khz to XIN/XOUT have
>   > any
>   > > effcct on the DCO itself, like stabilizing it?
>   > >
>   > > 2.) Without any external crystal the DCO is
>   > 800kHz?
>   > >
>   > > I appreciate your valuable time.
>   > >
>   > > Jay
>   > >
>   > > --- Matt Sabino <msabino@msab...> wrote:
>   > >
>   > > > Hi Jay,
>   > > >     Depending on how you set up SELS and SELM,
>   > you
>   > > > can get your clock from a
>   > > > number of points.  The major point is that the
>   > Main
>   > > > clock (MCLK) is for your
>   > > > code execution, the Sub-System Clock (SMCLK) is
>   > for
>   > > > all of your I/O and
>   > > > peripherals, such as the USART, and the ACLK is
>   > for
>   > > > your TimerA/B.  All of
>   > > > the peripherals can be changed to run off
>   > different
>   > > > clocks if you set them
>   > > > up that way.
>   > > >     If you are looking to get a 2MHz-4MHz from a
>   > > > 32kHz clock then I suggest
>   > > > using the DCO or change your crystal.  The
>   > downfall
>   > > > with the DCO is that it
>   > > > isnt accurate and frequently needs to be updated
>   > to
>   > > > maintain that frequency.
>   > > > The DCO is just an RC circuit, IIRC, and
>   > therefore
>   > > > changes in voltage,
>   > > > temperature, etc will affect its frequency.
>   > > >     If you are connecting the 32kHz crystal to
>   > XIN
>   > > > and XOUT then you can
>   > > > access the clock immediately on ACLK.  Now
>   > whether
>   > > > you choose to use the DCO
>   > > > or the crystal is all up to you and your
>   > application
>   > > > and what constraints
>   > > > you need to meet.
>   > > >
>   > > > HTH,
>   > > >
>   > > >
>   > > > Matt Sabino
>   > > > Computer Engineer
>   > > > Airtronic Services, Inc.
>   > > >
> 
> 
> 
> 
>   .
> 
> 
> 
> 
>         
>              
>        
>        
> 
> 
> ------
>   . 
> 
> 
> 
>   ---
>   Outgoing mail is certified Virus Free.
>   Checked by AVG anti-virus system (http://www.grisoft.com).
>   Version: 6.0.749 / Virus Database: 501 - Release Date: 9/1/2004
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 


Hi, 

More words of caution... The DCO clock is not "preset" to anything - 
it can vary from about 700Khz to just over 1MHz. Using the internal 
Rosc resistor, the DCO can be set to anything from 500 Hz to about 
4.5 MHz, +/- 20%. With the external resistor, the DCO can be set as 
high as around 16MHz (the micro is not spec'd for that, but the 
timer is spec'd to 10-12 MHz). A 100K Rosc to Vcc will give a 
default value of about 2MHz (+/- about 5%, but stable across temp 
and Vcc to about 1-2%), plus full 8MHz range of the DCO. Crystals 
can take as long as 1/2 to 1 second to start up, especially in cold 
environments, or when the capacitance is not correctly matched. Use 
of high frequency crystals will usually cost a lot in terms of power.

TI has many code samples on the MSP430 website (which you can get to 
with www.msp430.com), including a couple for creating a software 
FLL. I like to use the external Rosc and just calibrate it once on 
power up (it's good enough for a UART, and doesn't reserve timer 
resources forever), but there's also an example for a continuous 
calibration.

There will be a new family (MSP430F2xx) that will use the '4xx clock 
system with hardware FLL. Since the Rosc will be deleted, they are 
stabilizing the DCO to 1-2%. This family will also run faster (12-
16MHZ), and have lower power per MHz. Some other specs will also be 
improved. A version of the 'F11x1 (called 'F21x1) will start 
sampling around November-December, with production in late Q1-05.

Mike.