Jump to content

Flashing the missing DCO calibration constants

Recommended Posts

I'm new here, and haven't been able to go through all of this thread, but just wanted to report that it's possible to generate the 8 MHz settings for a G2231 without installing a crystal.  Steve Gibson did this for a project a while back, and he incorporates the calibration code into the firmware.  On powerup he checks to see if the 8 MHz values are there, and if not he does the calibration and writes the result to INFO memory.  It takes about 20 seconds to do this, but only on the first powerup.


It's basically the same as using a crystal, but instead he uses the low-frequency oscillator in the chip.  Of course it's not accurate like a crystal would be, but apparently is very stable.  So basically, you set the clock to the calibrated 1 MHz, and using TimerA you count count up for a few low-frequency cycles, then set the clock to trial 8 MHz settings, set the TimerA divisor to 8, and see if you get the same result as before.  If not, you adjust the trial settings until you get "very close".


This produces an 8 Mhz clock that's as accurate as the 1 MHz calibration is - no better, no worse - which is normally good enough.  And I was encouraged to find that if you run this code multiple times on the same chip, you get the same answer each time.


I haven't tried it, but I assume with a little tweaking it would be possible to do 12 MHz and 16 MHz as well.


I apologize if this has been covered before.  I just didn't see anything that didn't require a crystal.

Link to post
Share on other sites
  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

EDIT: Here's another really nice DCO calibration program. It's part of TinyOS-msp430. http://code.google.com/p/tinyos-msp430/ It's the file called calibrate-dco. As gordon, who discovered it said,

Hi Guys,   I wanted to tack on my calibration code that I successfully used to calibrate my G2231 device.   It's almost exactly like naturetm's code. The only difference is the setDCO() function h

IMHO it's not good idea, erase full segment A. There is probably stored more device-depended constants, not only DCO calibration. (Look at page 644 in slau144.pdf - "SegmentA structure"). Better idea

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...