This function is not executing on CCE compiler, what's the problem?
static void halMcuInit(void)
{
volatile uint16 tmp = 0;
int i;
WDTCTL = WDTPW | WDTHOLD; // Disable the watchdog.
// Setup code taken from TI example code: msp430x22x4_adc11_temp.c.
ADC10CTL1 = INCH_11 + ADC10DIV_3; // Internal bus voltage, ADC10CLK/4
ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
/* Allow Vdd to settle before reading it and re-configuring the system clock.
* MSP FAE confirmed that it can take up to 1 second for the Vdd to settle.
*/
while (--i);
while (--i);
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start.
LPM1;
//__low_power_mode_1(); // Low power during sampling period.
// Clear the signal that the ADC sample is ready - it is only to be used here.
halAdcval = ADC10MEM;
halEventFlags &= ~HAL_EVT_ADC;
//ADC10CTL0 &= ~HAL_EVT_ADC;
// Measurement of AVcc/2 is in range 0 to 1023 indicating voltage from 0 to 1.5V.
tmp = (halAdcVal * 30 + 512) / 1024; // Convert to units of 0.1V
// Cannont use 8-MHz if the Calibration values have been erased or if the bus voltage < 2.2V.
if ((tmp >= 2.2) && (CALBC1_8MHZ != 0xFF) && (CALDCO_8MHZ != 0xFF))
{
// Configure the system clock for 8-MHz by loading the calibrated values from the info memory.
BCSCTL1 = CALBC1_8MHZ;
DCOCTL = CALDCO_8MHZ;
}
else
{
halEventFlags |= HAL_EVT_NO_8MHz;
}
}
Problem is at halAdcVal=ADC10MEM instruction.