Other Parts Discussed in Thread: MSP430AFE253
I am using the MSP430AFE253 chip with no external crystal. I am trying to incorporate the iec60730 class b functionality and am having trouble getting "bool IEC60730_OSCILLATOR_TEST_testOsc(void)" to run correctly.
bool IEC60730_OSCILLATOR_TEST_testOsc(void)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
uint16_t freqCounter = 0;
const uint16_t freqMin = FREQUENCY_COUNT_MIN;
const uint16_t freqMax = FREQUENCY_COUNT_MAX;
/* Feed WDT in case user has WDT enabled before running CPU test */
#if ENABLED_WDT
uint16_t wdtConfig = WDTCTL & 0x00ff;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
WDTCTL = WDTPW + WDTCNTCL + wdtConfig;
#endif /* ENABLED_WDT */
frequencyMin = freqMin;
frequencyMax = freqMax;
/*
* Assign CCRn the value of CCRn_VALUE_FOR_10_mSEC to count up in
* 10 msec intervals. CCRn_VALUE_FOR_10_mSEC macro is defined in
* "IEC60730_system_config.h" file. However, the macro is calculated based
* on MAIN_CLOCK_FREQUENCY, LFXT1_FREQUENCY, MAIN_CLOCK_DIVIDER and
* LFXT1_FREQUENCY_DIVIDER and WDT_ENABLED.
*/
#if defined(USE_TA0)
#if defined(USE_CCR0)
TACCR0 = CCRn_VALUE_FOR_10_mSEC;
#endif /* USE_CCR0 */
#if defined(USE_CCR1)
TA0CCR1 = CCRn_VALUE_FOR_10_mSEC;
#endif /* USE_CCR1 */
#if defined(USE_CCR2)
TA0CCR2 = CCRn_VALUE_FOR_10_mSEC;
#endif /* USE_CCR2 */
#if defined(USE_CCR3)
TA0CCR3 = CCRn_VALUE_FOR_10_mSEC;
#endif /* USE_CCR3 */
#if defined(USE_CCR4)
TA0CCR4 = CCRn_VALUE_FOR_10_mSEC;
#endif /* USE_CCR4 */
TACTL = TASSEL_1 + MC_2 + TACLR + ID_3; // TASSEL_1 = ACLK, MC_2 = U mode, Clear Timer
/* Increase freqCounter until TAxR reaches CCRn_VALUE_FOR_10_mSEC */
#if defined(USE_CCR0)
TACCTL0 &= ~CCIFG;
// TACCTL0 |= CCIE;
P1OUT |= BIT7;
do
{
freqCounter++;
} while(!(TACCTL0 & CCIFG));
P1OUT &= ~BIT7;
I am getting stuck in the do --while loop. It seems as if while(!(TACCTL0 & CCIFG)); never gets satisfied. The freqCounter is incrementing but it seems as if TACCTL0 isn't being checked.
It just stays in the while loop forever.
Have any ideas as to why TACCTL0 & CCIFG doesn't seem to be functioning?
Steve