Hello,
Recently, I have tried to mesure my CPU temperature from the integrated sensor in my LPC54628J512
-First, I openned the lpc_adc_basic SDK example, to verify that I can read the ADC value. I thinck there is a mistake in the configuration : it's configured with ADC Channel 4, instead on Channel 0.
-Then, I have implemented the conversion in my system and verify that the mesured temperature correspond to reality. I have used calibration values from the DataSheet (https://www.nxp.com/docs/en/data-sheet/LPC546XX.pdf p142). With theses values I see a big difference.
This is my measures:
-my VDDA is 3.32V
-at 0°C ± 2°C, I mesure 700. -> with 12-bit ADC and 3.32V, that represent 700*3.32/4095 = 567 mV
In the datasheet, the value at 0°C is 584 mV (seems equal to my measure but that represent 10°C difference)
-at 28°C ± 2°C, I measure 641, that represent 700*3.32/4095 = 520 mV, this is in the range given in the datasheet
So I took it that the slope of -2.04 mV/°C is also false.
With my measures, I have calculated a slope of -1.69 mV/°C
I cannot make the experience with more extrem temperatures (the sensor works from -40°C to +105°C) so I think it's possible to improve the accuracy of my results.
Can you take a look at this ?
Best regards,
Lucas TERRIER
Hi, Lucas,
I think it is okay to use the lpc_adc_basic SDK example to measure the on-chip temperature sensor voltage and figure out the temperature.
I suppose that the on-chip temperature sensor is a high impedance source, I think you'd better set up the sample time longer with the code:
static void ADC_Configuration(void)
{
adc_config_t adcConfigStruct;
adc_conv_seq_config_t adcConvSeqConfigStruct;
/* Configure the converter. */
#if defined(FSL_FEATURE_ADC_HAS_CTRL_ASYNMODE) & FSL_FEATURE_ADC_HAS_CTRL_ASYNMODE
adcConfigStruct.clockMode = kADC_ClockSynchronousMode; /* Using sync clock source. */
#endif /* FSL_FEATURE_ADC_HAS_CTRL_ASYNMODE */
adcConfigStruct.clockDividerNumber = DEMO_ADC_CLOCK_DIVIDER;
#if defined(FSL_FEATURE_ADC_HAS_CTRL_RESOL) & FSL_FEATURE_ADC_HAS_CTRL_RESOL
adcConfigStruct.resolution = kADC_Resolution12bit;
#endif /* FSL_FEATURE_ADC_HAS_CTRL_RESOL */
#if defined(FSL_FEATURE_ADC_HAS_CTRL_BYPASSCAL) & FSL_FEATURE_ADC_HAS_CTRL_BYPASSCAL
adcConfigStruct.enableBypassCalibration = false;
#endif /* FSL_FEATURE_ADC_HAS_CTRL_BYPASSCAL */
#if defined(FSL_FEATURE_ADC_HAS_CTRL_TSAMP) & FSL_FEATURE_ADC_HAS_CTRL_TSAMP
adcConfigStruct.sampleTimeNumber = 7U; //RONG wrote
Unfortunately, the on-chip temperature is NOT accurate, the absolute temperature error is +/-5 degree.
Pls refer to the section in data sheet of LPC546xx.
7.22 Temperature sensor
The temperature sensor transducer uses an intrinsic pn-junction diode reference and
outputs a CTAT voltage (Complement To Absolute Temperature). The output voltage
varies inversely with device temperature with an absolute accuracy of better than ±5 C
over the full temperature range (40 C to +105 C). The temperature sensor is only
approximately linear with a slight curvature. The output voltage is measured over different
ranges of temperatures and fit with linear-least-square lines.
After power-up, the temperature sensor output must be allowed to settle to its stable value
before it can be used as an accurate ADC input.
For an accurate measurement of the temperature sensor by the ADC, the ADC must be
configured in single-channel burst mode. The last value of a nine-conversion (or more)
burst provides an accurate result.
Hope it can help you
BR
XiangJun Rong