Part Number: MSPM0L1304
Hi,
In int main(void), after SYSCFG_DL_init();, I get tempVoltageRef value once for all.
#define TEMP_OFFSET 30U
uint16_t gADCSamples[ADC_SAMPLE_SIZE];
int main(void) {
int16_t adc_temp_raw, temp_raw
...
SYSCFG_DL_init();
tempVoltageRef = (int16_t)(DL_FactoryRegion_getTemperatureVoltage() & 0x0FFF);
Later in while loop, I subtract ADC value for temperature sensor/channel 11 from above tempVoltageRef, and using below equation from manual, I get temperature in Celsius C.
while (1) {
adc_temp_raw = tempVoltageRef - (int16_t)(gADCSamples[3] & 0x0FFF); // Temperature
temp_raw = (int16_t)((adc_temp_raw / 8) + (adc_temp_raw / 16) +
(adc_temp_raw / 128) + TEMP_OFFSET);
I debug the code, and it read totally wrong and very big value for temperature. Please kindly provide a sample code that works.

Kind Regards


