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.

Good MSP430's for Accurate Timing?

Other Parts Discussed in Thread: MSP430F2012, MSP430G2210

Hi all,

I am wondering if anyone out there who knows a significant amount about the various MSP430s out there could help me determine a good MSP430 to use for accurate timing purposes. I am currently using an MSP430F2012 and other than the fact that I have to add a constant overhead in my Timer_A module to get the exact timing that I want, apparently, this constant factor is always different with each individual MSP430 that I use (They are all the same MSP430F2012 type).

With regards to the constant overhead in general, is there any way that I can avoid that? I assumed that using Timer_A would give accurate delays, but apparently that is not the case for all delays unless I add this constant factor. Someone also said that assembly would be the only way to be very exact. Is that entirely true?

Also, would anyone know of a certain MSP430 that is around the size of the MSP430F2012 (preferably smaller) that would be more reliable in terms of each individual microcontroller? Are there any MSP430s that do not vary so much in terms of their hardware, or is this just something I would have to accept? Because I would prefer it if I didn't have to change the constant factor for my timing functions with each specific MSP430 that I use.

Thanks,

Matt

  • Hi Matthew,

    The biggest variance would not be the TimerA module itself, but rather the clocking source.  DCO, even using the calibrated settings, will result in +/- 1% tolerance at 25°C and 3V Vcc.  Over the tange, the tolerance can reach up to +/-3%.  VLO is not an option for accuracy either.

    If you're looking for accuracy, you need to use an accurate timebase; a 32.768KHz crystal oscillator rated for +/-20ppm tolerance will give you the accuracy you desire. 

    Are you only using this part to serve as an intelligent timer?  If so, you may want to look at the msp430g2210 or another device in the G2xx series.  

  • Thanks for the reply Michael,

    I have a few general questions about the Timer_A module, because I feel like I could be getting an accurate delay if I change some things up:

    I currently have my delays based on Timer_A module, which uses SMCLK. However, as you can see from the following quote from the documentation:

    After a PUC, MCLK and SMCLK are sourced from DCOCLK at ~1.1 MHz (see
    the device-specific data sheet for parameters) and ACLK is sourced from
    LFXT1CLK in LF mode with an internal load capacitance of 6pF.

    SMCLK is only an approximate number. I wanted to try using ACLK as my source for the timer. I know how to set Timer_A to ACLK, but I do not know how to set ACLK specifically. I tried blinking an LED with delays using an ACLK and saw that blinking does occur, which means that ACLK is counting, but I do not know this default value. Could you give me some insight as to what the default value of ACLK is, and how to change that value in software? Also, am I able to change SMCLK in software, and if so how? If I could change SMCLK to an accurate and maybe faster clock, I might be able to get accurate delays across all the MSP430F2012s I use.

    Lastly, would you happen to know what these lines are for:

    DCOCTL = 0; // Select lowest DCOx and MODx settings
    BCSCTL1 = CALBC1_1MHZ; // Set DCO
    DCOCTL = CALDCO_1MHZ;

    Does this only have to do with accuracy, or the actually frequency of specific clocks? And for whichever case, which clocks does it affect?

    Any help would be greatly appreciated.

    Thanks,

    Matt

  • Matthew Wasko said:

    DCOCTL = 0; // Select lowest DCOx and MODx settings
    BCSCTL1 = CALBC1_1MHZ; // Set DCO
    DCOCTL = CALDCO_1MHZ;

    Does this only have to do with accuracy, or the actually frequency of specific clocks?

    You can find answer in the user manual, chapters:

    5.2.5 Digitally-Controlled Oscillator (DCO)

    24.2.1 DCO Calibration TLV Structure

    It's not about msp430, they all have more or less equal DCO properties.

    For few percent accuracy DCO calibration constants is fine, but DCO have temperature-drift. For long term timebase counting (clock) 32KHz oscillator shall be used. For fast accurate and more temperature-stable than DCO, clocks and/or short accurate delays you shall use hi-freq XTAL. There's high precision oscillators like TCXO or OCXO and atomic clocks to consider too. One more solution would be run-time calibration of DCO using 32KHz scillator, this does not give precision as XTAL and it have some jitter. So basically it all depends on your application requirements.

  • Matthew Wasko said:
    I have a few general questions about the Timer_A module, because I feel like I could be getting an accurate delay if I change some things up:

    Ypou cannot raise timing accuracy by software. For the MSP, a clock cycle is a clock cycle is a clock cycle. No matter whether there are 10 or 10 million clock cycles per second, and whether they are equally long or not (unless they are too short to perform a CPU step).

    The only way to get a precise timing is to attach a precise timing source. Such as a crystal. Next to this, you would need to ensure that neithe rVcc (which is easy) nor die temperature (which is next to impossible) won't ever change, and then do a precision calibration run, using - guess - a precise external timing source, such as a crystal.

    The calibration constants are the settings that give an output frequency that is as close as possible (but not perfect) to 1MHz for a supply voltage of 3V (?) and a die temperature of 30°C. But even if you can ensure these conditions, there is still a big chance that the frequency is off by an amount that makes long-time precision timing impossible. The DCO only has a limited number of frequencies it can produce. And exactly 1.0 MHz most likely isn't one of them.

**Attention** This is a public forum