This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Temperature sensor for CC2538

Other Parts Discussed in Thread: CC2538

Hi, I am new to zigbee, I need help on temperature sensor SoC for CC2538,  i'm trying to measure the temperature but I can't. The result change according to power source (,battery or usb. ), giving a impression of internal reference of A/D is floating. Thjis issue doesn´t happens when read are made from another A/D inputs. (I'm using CC2538DK with SmartRF 06)  

I try this code below.

Regards,

// Configure ADC, Internal reference, 512 decimation rate (12bit)
//
SOCADCSingleConfigure(SOCADC_12_BIT, SOCADC_REF_INTERNAL);
//
// Trigger single conversion
//
SOCADCSingleStart(SOCADC_TEMP_SENS);
//
// Wait until conversion is completed
//
while(!SOCADCEndOfCOnversionGet());


TAD = SOCADCDataGet() >> SOCADC_12_BIT_RSHIFT;

value_t = (uint32_t)TAD;

value_t *= 1000;

value_t *= 119; // 119 mV ADC reference voltage

value_t /= 2047; // 2047 positive samples with 12 bits resolution

value_t -= 1317; // 743 mV at 0 °C

value_t /= 420; // 2.45 mV per °C


value_t /= 1000;

temp_t = (value_t % 100);

sprintf(str_t, "Temp = %d.%d C", (value_t/100), (value_t%100) );

HalLcdWriteString (str_t, HAL_LCD_LINE_7);

//

// Simple wait
//

for(uint32 Loop = 0; Loop < 200000; Loop++);