Hello All,
We are manufacturing company and we recently started mass production of a system with MSP430F6723. Till now, we produced around 1500 units, out of that 6 are not working for MSP430 inbuilt Temperature sensor. In our application, we are entering/exiting both LPM0 and LPM3 more frequently and also we are executing this below temperature sensor function once in every 15 minutes and forever.
The problem we see with Temperature sensor in faulty units is: after reset the temperature is always showing as 0 even after many hours, it means always failing to sense the temperature if it fails even once after reset. Where as good ones are always working with the same code.
Please find the code below and suggest the fault in this and the way to handle this.
//This is called during firmware initialization and for every 15 minutes and forever.
bool Msp430TempSensorConfigure(void);
//This is called in the Interrupt service routine.
void Msp430TempSensorStop(void);
//MSP430F6723 Temperature sensor calibration factors
#define CALADC10_15V_30C *((unsigned int *)0x1A1A) // Temperature Sensor Calibration at 30°C
#define CALADC10_15V_85C *((unsigned int *)0x1A1C) // Temperature Sensor Calibration at 85°C
// ADC10 configuration for measuring Temperature with MSP430 Inbuilt temperature sensor
bool Msp430TempSensorConfigure(void)
{
// Configure ADC10 - Pulse sample mode; ADC10SC trigger
ADC10CTL0 = ADC10SHT_8 + ADC10ON; // 16 ADC10CLKs; ADC ON,temperature sample period>30us
ADC10CTL1 = ADC10SHP + ADC10CONSEQ_0; // s/w trig, single ch/conv
ADC10CTL2 = ADC10RES; // 10-bit conversion results
ADC10MCTL0 = ADC10SREF_1 + ADC10INCH_10; // ADC input ch A10 => temp sense
// Configure internal reference
while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT
REFCTL0 |= REFVSEL_0+REFON; // Select internal ref = 1.5V, Internal Reference ON
//Enable ADC10 Interrupt and conversion start
ADC10IE |= ADC10IE0; // enable the Interrupt request for a completed ADC10_B conversion
ADC10CTL0 |= ADC10ENC + ADC10SC; // Sampling and conversion start
return TRUE;
}
//ADC10 completely stop function
void Msp430TempSensorStop(void)
{
ADC10CTL0 &= ~ADC10ENC; // ADC10CTL0 can be modified only when ADC10ENC = 0
while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT
REFCTL0 &= ~REFON; // Select internal ref = 1.5V
ADC10CTL0 &= ~ADC10ON; // ADC10 switched off
}
//ADC10 Interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
{
volatile int32 i32_AdcValue;
int16 i16FinalTemperature;
switch(__even_in_range(ADC10IV,12))
{
case 12:
i32_AdcValue = ADC10MEM0;
ADC10IE &= ~ADC10IE0; // disable the Interrupt request for a completed ADC10_B conversion
Msp430TempSensorStop();
i16FinalTemperature = (i32_AdcValue - CALADC10_15V_30C) * (85-30)/(CALADC10_15V_85C-CALADC10_15V_30C) +30;
//With MSP430 temp sensor, there is an offset of gi16_TempCalibration between actual and measured temperature. This gi16_TempCalibration is configured/supplied for all units individuallly in production. i16FinalTemperature will hold the measured temperature in degree Celcius for further actions in app.
i16FinalTemperature -= gi16_TempCalibration;
break;
default:
break;
}
}
Many thanks
Venkat