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.
Hello,
I'm new to the MSP430 and I've never programmed TI micros before. At first I'm trying to configure the DCO so I can use it as the master clock as well and it's a bit confusing. I've searched online and used the launchpad resourses wiki, all great info, but don't clearly understand how the DCO is configured.
I gave the MSP430G2553 which is the one that comes with the $4.30 launch pad.
So in short for configuring the DCO to 8MHz using the calibration values all I need to do is use the bellow two lines??
void clock_init(void)
{
DCOCTL = CALDCO_8MHZ;
BCSCTL1 = CALBC1_8MHZ;
BCSCTL2 = 0x00; //This is reset during PUC
BCSCTL3 = 0x05; //This is default after PUC
So what does DCOCTL = CALDCO_8MHZ; do? it automatically sets the values for MODx and DOCx?? How can I find out what the calibrated values are?
Does BCSCTL1 = CALBC1_8MHZ; do the same thing? puts in the saved calibration values into RSELx, DIVAx, XTS, XT2OFF??
BCSCTL2 I think I can understand for setting the other clocks and dividers.
BCSCTL3 I'm not really sure about this one.
Any help trying to help me understand or pointing me in the right direction will be appreciated. Thanks.
Hi Jose,
The CALDCO_8MHZ and CALBC1_8MHZ do what you have described - they are calibrated data DCOCTL register and BCSCTL1 register settings for a particular frequency. This data is specific to each device - it is calibrated and programmed in before each part leaves the factory. This calibration data is stored in a TLV (tag-length-value) structure stored in segment A of Information memory (this is why segment A is locked at reset, to help protect this data). See the MSP430G2553 datasheet on p. 15 - Table 11 lists calibration data stored in the TLV. All the CALDCO_8MHZ and CALBC1_8MHZ do is provide an easy way to access the correct location in the flash for you - you can view what is stored in these values via memory view or a watch window in your IDE I think.
Note - A good thing to do in your clock init is to check whether CALDCO_8MHZ and CALBC1_8MHZ are set to 0xFF before choosing to write them into the DCOCTL and BCSCTL1 registers, instead trapping the code and somehow signalling an error in your system. This is to make sure that INFO A has not been erased accidentally, which would mean that the values are not valid and catch this case.
Regards,
Katie
**Attention** This is a public forum