Hello,
1. I read values from internal temperature sensor with ADC. In data sheet I found formula for temperature calculation:
TEMP = 147.5 - ((75 * (VREFP - VREFN) × ADCCODE) / 4096)
My VREFP = 3.3V and VREFN = 0V, I multiplied all 10 and in code formula looks:
final_result = (double)(1475 - 75 * 33 * sample / 40960);
It gives me value too high, about 55 degree Celsius.
When I use formula from older project that use Stellaris processor:
final_result = (double)((1475 * 4096 - 75 * 33 * sample) / 40960);
it gives me more logical value, about 35 degree Celsius.
What is wrong with formula that I obtained from data sheet of Tiva?
2. I work also with couple another external temperature sensors in the same way like internal temperature sensor.
I paid attention on that when I connect external sensor I see that measured temperature of internal sensor of Tiva increases by 4 degrees.
Why it happens?
3. The temperature measurement occurs every 2 sec by interrupt from timer. Within these short intervals temperature can vary by several degrees. The measurement is carried out in a laboratory where there is no abrupt temperature jumps. Other sensors doesn't have these jumps. Is it proper work for internal temperature sensor?
Example of current code:
uint32_t sequence; uint32_t channel; uint32_t sample; double final_result; // configure the ADC sequence MAP_ADCSequenceConfigure(ADC0_BASE, sequence, ADC_TRIGGER_PROCESSOR, 0); MAP_ADCSequenceStepConfigure(ADC0_BASE, sequence, 0, channel | ADC_CTL_IE | ADC_CTL_END); MAP_ADCSequenceEnable(ADC0_BASE, sequence); MAP_ADCIntClear(ADC0_BASE, sequence); MAP_ADCProcessorTrigger(ADC0_BASE, sequence); // Wait for conversion to be completed. while(!MAP_ADCIntStatus(ADC0_BASE, sequence, false)) {} MAP_ADCSequenceDataGet(ADC0_BASE, sequence, &sample); final_result = (double)((1475 * 4096 - (75 * 33 * sample)) / 40960);
Regards,
Sergey