LPC54608 Temperature Sensor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC54608 Temperature Sensor

1,812 Views
eileen_radzwion
Contributor II

ello, 

I am trying to use the on-chip temperature sensor that is internally routed to the adc's channel 0.  I found in the data sheet for the lpc54608 we must configure the ADC in single channel burst mode.  I have used the adc driver example from the sdk version 2.6, called lpc_adc_burst.  

the result after more than 9 conversions is 919.  To determine what this equals in mV, i use the equation  (Vref_p - Vref_n)/4095 * V_in *1000 = 2.5/4095 * 919*1000.

   (with a Vrev_p = 2.5, and Vref_n = 0, and 12 bit resolution)

therefore, the input is 561mV. 

Using the graph and tables from the data sheet, this can be fed into an equation based on LLS of: 

   mV = (-2.04)*temperature + 584   => temperature = (mV - 584)/(-2.04).

this means, in our case with 561mV we have:

   temp = (561-584)/(-2.04) = 11.275°C 

Considering this is sitting in ambient office temperature, I hardly think this is accurate. 

again, please note, this is using the sdk 2.6 version of lpc_adc_burst with only modification to remove the getchar() to initiate the conversions

in main:

...
ADC_Configuration();

/* Enable the interrupt. */
ADC_EnableInterrupts(DEMO_ADC_BASE, kADC_ConvSeqAInterruptEnable);
NVIC_EnableIRQ(DEMO_ADC_IRQ_ID);

PRINTF("Configuration Done.\r\n");

#if defined(FSL_FEATURE_ADC_HAS_CTRL_RESOL) & FSL_FEATURE_ADC_HAS_CTRL_RESOL
PRINTF("ADC Full Range: %d\r\n", g_Adc_12bitFullRange);
#endif /* FSL_FEATURE_ADC_HAS_CTRL_RESOL */
while (1)
{
 //GETCHAR();

gAdcConvSeqAIntFlag = false;

/* ADC_DoSoftwareTriggerConvSeqA(DEMO_ADC_BASE); */
/* Enable the burst mode and start the conversion. */
ADC_EnableConvSeqABurstMode(DEMO_ADC_BASE, true);

while (!gAdcConvSeqAIntFlag)
{
}
PRINTF("gAdcResultInfoStruct.result = %d\r\n", gAdcResultInfoStruct.result);
PRINTF("gAdcResultInfoStruct.channelNumber = %d\r\n", gAdcResultInfoStruct.channelNumber);
/* PRINTF("gAdcResultInfoStruct.overrunFlag = %d\r\n", gAdcResultInfoStruct.overrunFlag ? 1U : 0U); */
PRINTF("\r\n");
}
}

0 Kudos
Reply
4 Replies

1,537 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Eileen,

I think your code is correct, your computation is correct. Note that you have to wait for 10us after power-up, then use ADC to sample the temperature sensor.

The temperature accuracy is 3.7 degree from -40 to 105 based on data sheet.

Hope it can help you

BR

XiangJun Rong

pastedImage_1.png

0 Kudos
Reply

1,537 Views
eileen_radzwion
Contributor II

can i get some guidance please

0 Kudos
Reply

1,537 Views
eileen_radzwion
Contributor II

Hi,

I have rerun the test with slightly different results, I also compared to the newer version of the sdk (2.7) as i'd prefer to use the updated code, but the results there were completely unacceptable.  I again have commented out the getchar as this is on a custom board, and these are the results of my testing.  in 2.7 version, i had to change the code to use channel 0 rather than channel 4 in the examples.   

i have included all code in the zip here, along with more details of the testing.  I would prefer to use 2.7 as that is more up to date, but why is it not consistent?  Also, why are the results different for 2.6 burst?  this is the same board and same code?

thanks,

eileen

sdk 2.6 basicsdk 2.6 burstsdk 2.6 int
avg535.256423.89392avg541.855920.65886avg537.435922.82554
min534.18823.22057min540.903520.22792min536.6322.02351
max536.6324.41763max542.73521.12572max539.07223.22057

2.7 basic2.7 burst2.7 int
avg468.211256.7592avg489.584946.28193avg472.61954.59851
min435.897432.79705min460.92831.30073min438.949933.09632
max517.09472.5993max520.146560.32943max516.483571.10297
0 Kudos
Reply

1,537 Views
eileen_radzwion
Contributor II

sorry, but i really need some direction.  i have started using the 2.6 adc burst code just so i can move on, and now, again, i'm getting result in the 915-920 range, translating to 10.95-12.45°.  This is using the exact same output file from IAR that is included in the zip folder above. how can i be getting such drastically different results with the exact same image, exact same location, board, etc, etc...   ?

just so you are aware, ambient temperature is 21°C

Thank you,

Eileen

0 Kudos
Reply