TI E2E Community
MSP430 Ultra-Low Power 16-bit Microcontroller Forum
Basic Clock Module settings
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 programexecution?
paddu1Is 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).
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.
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.
paddu1because after reset the DCO will start from the lowest settings.
DCOx starts with DCO_3 after a reset, not with DCO_0.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.