cancel
Showing results for 
Search instead for 
Did you mean: 

help needed to acquire STM32G474VET6 internal temperature

phdm
Associate

Hello community,

I am new to stm32, and I need to read the temperature from the internal sensor of a stm32g4vet6.

I am at the point where I have read many things and have discovered that not all stm32's internal temperature sensors must be used the same way.

Currently I have asked to connect vref and temperature sensor to ADC5, asked for calibration of ADC5, and configured high values for the sampling time, and I can read adc-measured values for vref and temperature.

I can compute a temperature with

temperature = (130 - 30) * (Adc.Raw[0] * 33 / 30 - *TEMPSENSOR_CAL1_ADDR) / (*TEMPSENSOR_CAL2_ADDR - *TEMPSENSOR_CAL1_ADDR) + 30;

and I get plausible but unstable values.  (the nominal value of my Vref is 3.3 V)

However I wonder if I should use the value of Vref measured by the ADC, and *VREFINT_CAL_ADDR,  to get more stable values, and how ?

 

1 REPLY 1
TDK
Super User

Consider adding more details here. In what way are the values both plausible and unstable?

If this is a custom board, duplicate the issue on known good hardware such as a nucleo board.

If you feel a post has answered your question, please click "Accept as Solution".