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.

Basic Clock Module settings

Hi,

This is a basic question about the MSP430 clock settings for MSP430G2xx series.
Is it required to use the code "clr.b &DCOCTL ; set lowest DCOx and MODx settings"
when setting the DCO clock.
The user guide and the sample code recommends below to set the DCO clock.
clr.b &DCOCTL ; set lowest DCOx and MODx settings
bis.b #DCO2+DCO1+DCO0, &DCOCTL ; select max DCO Tap
bis.b #RSEL0+RSEL1+RSEL2, &BCSCTL1 ; select range 7

Is it safe to remove the "clr.b &DCOCTL" line if we do not need to reconfigure the DCO during program
execution?

Regards.
Paddu.

  • paddu1 said:
    Is it safe to remove the "clr.b &DCOCTL" line if we do not need to reconfigure the DCO during program execution?

    This line is required when you switch the RSEL setting. because when you just switch RSEL while DCOx is in the higher hegions, the resulting DCO frequency might be far too much for the MSP and it will crash.
    Also, during a switch of RSEL, there might be one truncated (= high-frequency) DCO pulse which won't do any good too.
    It is recommended to not only set DCOx back, but also use a /2 divider on MCLK while doing the switch.
    However, to make this precaution work, you must change RSEL before you set DCOx high again. (switch the two bis.b lines in your example)

    In your posted example, the clr.b probably isn't necessary, but it might leave a MODx bit set while DCOx is already on max, which is not a valid setting (even though likely not harmful).

  • Hello Jens-Michael,

    Thank you so much for the information.

    I understood that we need to set lowest tap when there is a need to switch RSEL(Frequencies).
    And according to my understanding if there is no necessary to switch between
    different frequencies, this code is not ncessary at the begining of the program(intialization of clock)
    because after reset the DCO will start from the lowest settings.

    Regards
    paddu.

  • paddu1 said:
    because after reset the DCO will start from the lowest settings.

    Take another look into the users guide.

    DCOx starts with DCO_3 after a reset, not with DCO_0.

**Attention** This is a public forum