Interfacing to STM32F767ZI temperature sensor
Hello to everyone. I am teaching an embedded system lab courses and this is our first year with a STM32F767ZI Nucleo board. We are at a point where we want to exploit the on-board temperature sensor to generate some input data. In our first experience with the sensor we are setting ADC1 in single channel, continuous conversion mode, and we are working with interrupts. The first thing I notice is that, if I apply the conversion formula on the MCU reference manual (RM0410 pag. 466, T = (V_sense - V_25)/Avg_Slope + 25), where V_sense is the value read by the temperature sensor and all the other data are on the datasheet, I obtain completely bogus values for T, of the order of 100 °C. Instead I found an application note (AN3964), that discusses the use of the temperature sensor for STM32L1x microcontrollers, and suggests a two-point approach based on the calibration data TS_CAL1 and TS_CAL2 to calculate the temperature. This yields temperature values much more realistic, closer to that of room temperature. My first question is if others experienced such a large discrepancy between the two methods.
My next questions are about my ideas for evolving the lab experience. The next step would be introducing multi-channel data acquisition via DMA. To this end my rough idea is to acquire both the temperature and the Vrefint channels from ADC1 and to use these data to apply the drift formula for battery-operated devices that I found on AN3964 to correct the sensed value. The formula is V'_sense = V_sense * 4096 * Vrefint / (V_DDA *V_REFINTCAL), where V'_sense is the after-correction value for V_sense, V_DDA is the ADC reference voltage, and V_REFINTCAL is on the datasheet. My questions are:
1- I might be completely dumb, but I cannot find how to obtain V_DDA. Is it the same as Vbat channel in ADC1?
2- This formula might be OK for STM32L1x, but what about STM32F767ZI? I am especially concerned about the 2^12 = 4096 factor.
3- Again, I might be completely dumb but I cannot understand whether Vrefint changes in time, and so must be resampled, or is stable, and so can be acquired once at startup.
Of course any suggestions to make the example more realistic, or to find a better example, are welcome.
Thank you
Pietro
