This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to configure internal DCO for msp430g2553

Other Parts Discussed in Thread: MSP430G2553

Hi,

     how to configure internal DCO for msp430g2553. If i configure DCO then the controller can run on its DCO frequecny right. And can you explain me what is difference between SMCLK and DCO. Thank you.

  • Hi,

     

    "DCO is Digitally controlled oscillator". To control it you will need to see the bits to set/clear in the family user guide section 5.3 (worth reading all of section 5).

    http://www.ti.com/lit/ug/slau144i/slau144i.pdf

    You can find information on the speeds in the device data sheet in the "DCO Frequency" section:

    http://www.ti.com/lit/ds/symlink/msp430g2553.pdf

     

    SMCLK (Sub Main Clock) is usually set to be the same as DCO, but can be configured to run from other sources, I believ from external oscillators/crystals or from the Timer modules. I may be wrong with this but I am not far off...

     

    There are macros for setting the DCO to certain speeds, I cant remembner them from the top of my head right now, but I believe they are

    CALIBRATE_1MHZ;

    CALIBRATE_8MHZ;

    CALIBRATE_16MHZ;

     

    I will confirm this when I get a chance, or maybe someone else can give a more precise answere.

     

    Good luck!

     

    EDIT: To set the DCO to certain speeds you can do this: 

        BCSCTL1 = CALBC1_1MHZ;                  // DCO at 1 MHz    

        DCOCTL = CALDCO_1MHZ;                   // DCO at 1 MHz

    You can also use 8MHZ or 16MHZ. I believe these are macros defined in the msp430.h header, though I am quite new to this but it works for me using CCSv5! For other speeds you will need to consult the userguides/datasheets for the correct bits in the DC0CTL and BCSCTL1 registers.

  • Dharani R said:
    And can you explain me what is difference between SMCLK and DCO. Thank you.

    DCO is an oscillator, SMCLK is a clock.
    Clocks are system.wide available clock pulse channels which can be selected by peripherals. 
    There's MCLK, SMCLK and ACLK for general usage. Also, there are a few others like ADC10CLK/ADC12CLK, TAxCLK etc. Think of them as somethign like the supply layers on a PCB.
    Now a supply layer must be sourced by something. These are the oscillators like DCO, REFO, VLO or XT1/XT2. The clock module offers configuration settings for wich oscillator shall sourced which clock. And in the peripherals you can choose which clock to use (without knowing or needing to know where it comes from).
    For the ADC10CLK/ADC12CLK, there's another oscillator available: MODOSC. And for TAxCLK, the clock source is an external signal on an input pin.

    About how to program the DCO, you'll find a description of the DCO in the "basic clock system +" chapter of the 2x family users guide. It is valid for all 2xx family devices. The explicit values of the DCO (min/max frequencies, tolerances, drift etc.) are in the 2553 datasheet.

  • Thanks Jens-Michael for brief explanation.

    and Can you explain me about the how to configure I2c (MSP430G2553) SCL clock frequency for 1MHZ DCO frequency.

  • Dharani R said:
    and Can you explain me about the how to configure I2c (MSP430G2553) SCL clock frequency for 1MHZ DCO frequency.

    You first configure the DCO for 1MHz. THen you configure SMCLK to be sourced by teh DCO (which is the default).

    Then you tell the USCI_B0 module to use SMCLK as clock source (see users guide for the USCI registers and how to configure them). and last, since the USCI I2C mode only supports up to 400kHz I2C clock, you configure the USCI to use a clock divider on SMCLK. e.g. UCB0BR0=3; to divide the 1MHz SMCLK by 3 for 333kHz I2C clock.

  • Hi,

    And can you also explain me about TIMER  TACCR0 calculation. For example 1sec timer. And also how to calculate PWM pulse ON and OFF time or duty cycle.

  • Dharani R said:
    And can you also explain me about TIMER  TACCR0 calculation.

    There is no 'calculation'.

    In UP mode, the timer counts from 0 to CCR0, then rolls over to 0 and counts up to CCR0 again. So one cycles takes (CCR0+1) counts. How much one count is depends on the clock with which you clock the timer.

    Dharani R said:
    And also how to calculate PWM pulse ON and OFF time

    This too depends on timer clock speed. However, there is a very detailed explanation with diagrams in the users guide.

**Attention** This is a public forum