Jump to content
43oh

Flashing the missing DCO calibration constants


Recommended Posts

Ya know, we're gonna have problems maintaining all the support files for processors that we calibrate.

 

Right now, we've modified the g2231 files but what about the rest of them?

 

Maybe I'm just worrying but it feels like a lot of work to keep track of which ones have we modified.

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

Ya know, we're gonna have problems maintaining all the support files for processors that we calibrate.

 

I guess it might be wise to have a header file with the calibration defines separate. That could then be included at the top of main.c. I don't know how to deal with the linker files though. I just had the user copy and rename the linker file in the tutorial. They could then edit the copy and preserve the original. Maybe we could create profiles for the calibrated chips in CCS so they could be selected in the new project wizard. I don't know how involved that would be. I imagine the gcc people just type the names of the files in the cli so they wouldn't need anything special.

 

By the way, I'm not sure if I was clear in my guide. G2231 was just an example. The method should work with the other value line chips too.

Link to post
Share on other sites
Hi, you can use Grace to configurate the frecuency to 16MHz

http://processors.wiki.ti.com/index.php ... +gracewiki

Enjoy it

But does grace calibrate the clock constants for you?

 

I don't know personally but I doubt it.

Grace cannot do the calibration, it's just a GUI for code settings. You could do the same settings in code but, if you haven't calibrated the chip, it won't work on the Value Line chips.

Link to post
Share on other sites
  • 2 months later...

For mspgcc users

 

use the code on the second page

and add this to your own header or add it to the msp430gxxxx.h header in the DCO calibration near the end of the file

xxxx = ie 2231, 2211....etc

code to add

#ifndef __DisableCalData
#define    CALDCO_16MHZ        0x10F8;
const_sfrb(CALDCO_16MHZ, CALDCO_16MHZ);
#define    CALBC1_16MHZ        0x10F9;
const_sfrb(CALBC1_16MHZ, CALBC1_16MHZ);
#define    CALDCO_12MHZ        0x10FA;
const_sfrb(CALDCO_12MHZ, CALDCO_12MHZ);
#define    CALBC1_12MHZ        0x10FB;
const_sfrb(CALBC1_12MHZ, CALBC1_12MHZ);
#define    CALDCO_8MHZ         0x10FC;
const_sfrb(CALDCO_8MHZ, CALDCO_8MHZ);
#define    CALBC1_8MHZ         0x10FD;
const_sfrb(CALBC1_8MHZ, CALBC1_8MHZ);
#define    CALDCO_1MHZ         0x10FE;
const_sfrb(CALDCO_1MHZ, CALDCO_1MHZ );
#define    CALBC1_1MHZ         0x10FF;
const_sfrb(CALBC1_1MHZ, CALBC1_1MHZ);
#endif /* #ifndef __DisableCalData */

 

 

or you can use the code from another header like msp430f2013.h

 

personally i just added it to a separate file and only include it for chips i have calibrated

Link to post
Share on other sites

Hi everyone,

 

I've added the checksum for proper verification of the data inside flash.

 

I've also regrouped code some parts in functions.

 

Finally, this version works with TI DCO calibration example in C (MSP430G2231 code examples), because I really don't understand asm.

 

Is there some specific reason you used asm routine for DCO calibration?

 

The attachment is the project in CCS4.

 

Thank you all, comments appreciated

dco_calibration.rar

Link to post
Share on other sites
Is there some specific reason you used asm routine for DCO calibration?

 

I chose asm for the original calibration function just because it was the first ti example code for setting the dco that I found. I wasn't aware of the C function at the time. Since the C routine is both more accurate and friendlier with linux, the C function should be better. Thanks for your contribution.

Link to post
Share on other sites

Ok, I've made

 

this simple program to see on P1.4 SMCLK with a probe oscilloscope.

 

SMCLK sources from MCLK with no prescaler.

 

On P1.4 I've outputted SMCLK with 8 prescaler, for usage with common oscilloscopes.

 

Launch the program you see the clock step change rising in frequency from default (1.2Mhz?)

 

to 1MHz to 16MHz.

 

I've checked with my oscilloscope the last frequency and it's correct (2Mhz * 8 = 16Mhz). I think the whole program

 

works.

 

NOTE: small and unimportant bug on dco_calibration, change if(!chk_data()) statement on line 88

with if(chk_data()) so you can see green led blinking if it's all ok.

 

Thanks

 

Max

dco_tryout.rar

Link to post
Share on other sites
  • 4 weeks later...

I guess it does belong in this thread. The other thread sets the DCO at runtime, while this thread and the code you posted actually flashes the calibrations after setting the DCO.

 

The code looks nice, and I wonder if I should edit the first post of the thread to link to what you found instead.

Link to post
Share on other sites
I guess it does belong in this thread. The other thread sets the DCO at runtime, while this thread and the code you posted actually flashes the calibrations after setting the DCO.

 

I think it does both, depending on WRITE_TO_FLASH defined in the options (see Makefile), no?

Link to post
Share on other sites

Join the conversation

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

Guest
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...