Reply by bb_stefan November 18, 20092009-11-18
--- In m..., "Michael" wrote:
>
> > Any ideas?
> Just one: Is your programming tool erasing info memory when you
>flash your program? If it is, you'll be erasing the calibration
>values each time you program a microcontroller, including the first
>time you program a new micro.

Yes, this was also my first thought.
But the all calib values should be 0xFF!

Beginning Microcontrollers with the MSP430

Reply by bb_stefan November 18, 20092009-11-18
First try setting calib values direcly (not or'ing):
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;

If needed, do changes in these registers afterwards.

Then you could try to calculate the checksum over all the calib values in INFO_A and check against the stored checksum (if your MSP430 has a TAG_STRUCTURE saved to INFO_A! Check your datasheet for information about this. Checksum calculation is described in the user guide: TLV Structure)
Reply by Michael November 18, 20092009-11-18
> Any ideas?
Just one: Is your programming tool erasing info memory when you flash your program? If it is, you'll be erasing the calibration values each time you program a microcontroller, including the first time you program a new micro.

Michael K.
Reply by merc...@gmail.com November 18, 20092009-11-18
Although i believe the Cal values may be hosed in my previous uC, I'm still having issues with resultant frequencies in a new uC.



Right now, i feel i should be getting a square wave frequency of 5kHz from P3.1. Instead, i'm getting about 8230Hz.
Also, when i change the BCSCTL1 and DCOCTL to 8 MHz settings, i get about 10x measured frequencies. Not 8x.

Also, i checked the memory address in IAR, and 0x10F(8-F), where the calibration settings reside, is not all FF's.

Any ideas?
Reply by Joseph J Mercuri November 17, 20092009-11-17
Thanks Greg and Old Cow.

I am going to double check the cal values right now, .

Old Cow, you're right about the count mode, I should change it to make it
more accurate. I was doing it dirty just to get a quick result. I appreciate
the help from both of you.
Reply by Greg Maki November 17, 20092009-11-17
m...@gmail.com wrote:
>
> I'm pretty sure that when CAP = 0 (in TACTL0), the timerA count hits
> TACCR0 and sets the interrupt flag (CCIFG). Then, in the interrupt I
> toggle P1.0, and reset TAR to zero, starting the count over. One reason
> i'm pretty sure of this, is that if I halve TACCR0, the signal period
> also cuts in half.
>
> And, oddly, increasing the DCO seems to have no effect. It seems that
> either way the interrupt trips, the increase in DCO freq should decrease
> the period.
>
> The only time i get an increase in signal frequency on the scope is when
> i go from default DCO settings (commenting out clock controllers) to
> enabling them.
>
> //BCSCTL1 |= CALBC1_16MHZ_;
> //DCOCTL |= CALDCO_16MHZ_;
> When i enable them, it doesnt matter which i use, whether 16MHZ, 8MHZ,
> whatever... they all cause the same output frequency.
>
> I'm wondering if i cant have the interrupt occuring at that frequency
> for some reason?
>

Perhaps your DCO calibration values have been overwritten or erased. That would
explain why your DCO frequency does not change when using the different CALBC1
and CALDCO values.

-Greg
Reply by old_cow_yellow November 17, 20092009-11-17
You are right. Sorry, I missed the line in the ISR that clears TAR. Most people would not do that, they use Up Mode (MC_1) to accomplish that automatically and more precisely.

Did you check if the factory DCO calibrations are valid? They are stored in InfoA Flash by TI and you could have erased them or altered them.
Reply by merc...@gmail.com November 17, 20092009-11-17
I'm pretty sure that when CAP = 0 (in TACTL0), the timerA count hits TACCR0 and sets the interrupt flag (CCIFG). Then, in the interrupt I toggle P1.0, and reset TAR to zero, starting the count over. One reason i'm pretty sure of this, is that if I halve TACCR0, the signal period also cuts in half.

And, oddly, increasing the DCO seems to have no effect. It seems that either way the interrupt trips, the increase in DCO freq should decrease the period.

The only time i get an increase in signal frequency on the scope is when i go from default DCO settings (commenting out clock controllers) to enabling them.

//BCSCTL1 |= CALBC1_16MHZ_;
//DCOCTL |= CALDCO_16MHZ_;

When i enable them, it doesnt matter which i use, whether 16MHZ, 8MHZ, whatever... they all cause the same output frequency.
I'm wondering if i cant have the interrupt occuring at that frequency for some reason?
Reply by old_cow_yellow November 17, 20092009-11-17
Your TACTL setting is using SMCLK (TASSEL_2) in Continuous Mode (MC_2). Thus TAR will count SMCLK from 0 to 65535 repeatedly and match TACCR (00) every 65536 counts. This means P1.0 will flip after every SMCLK/65536 counts.

Your observation on the scope is inconsistent with you code.
Reply by merc...@gmail.com November 17, 20092009-11-17
I'm just trying out the 1MHz clocking for now, mainly because when I change to the 16 MHz settings (from the 1MHz settings), there is no corresponding change to the period of the output signal.

The output now is at about a 109us period.... about 9174Hz.

Maybe i should mention that i'm using the ez430-RF2500 development tool along with USB debug stick.