Skip to main content
BSale.1
Associate II
October 18, 2021
Solved

Can't get reasonable values from the internal temperature sensor in nucleo-g474re board.

  • October 18, 2021
  • 5 replies
  • 1318 views
#define TEMP110_CAL_VALUE ((uint16_t*)((uint32_t)0x1FFF75CA))
#define TEMP30_CAL_VALUE ((uint16_t*)((uint32_t)0x1FFF75A8))
#define TEMP110 110.0f
#define TEMP30 30.0f

I am using these calibration values as I found them in the datasheet

For the conversion:

temperature = (int32_t)((TEMP110 - TEMP30) / ((float)(*TEMP110_CAL_VALUE) - (float)(*TEMP30_CAL_VALUE)) * (adcvalue - (float)(*TEMP30_CAL_VALUE)) + TEMP30);

I also used:

temperature=__LL_ADC_CALC_TEMPERATURE(VDDA_APPLI,AdcVals[0],LL_ADC_RESOLUTION_12B);

The values I get is 700-800 on the ADC value, which I think is a reasonable value but when converting the temperature is with a minus sign

This topic has been closed for replies.
Best answer by S.Ma

Even better, meaure vdda through vref adc measurement to have adaptive code.

5 replies

S.Ma
Principal
October 18, 2021

Look at nucleo G4 adc examples. First, did you calibrate the adc? What is adc supply voltage? Did you compensate for it ? How long is the adc sampling time?

BSale.1
BSale.1Author
Associate II
October 18, 2021
  • I did not calibrate the ADC, how to do so?
  • Jumper 8 is on 1 and 2
  • I am using 247.5 cycles for the temperature sensor
TDK
October 18, 2021

Per the datasheet, the calibration values are taken using VDD=VREF+=3.0V. The nucleo board uses 3.3V.

To correct for this, adjust the raw values you get from the ADC by multiplying by 1.1.

"If you feel a post has answered your question, please click ""Accept as Solution""."
S.Ma
S.MaBest answer
Principal
October 18, 2021

Even better, meaure vdda through vref adc measurement to have adaptive code.

BSale.1
BSale.1Author
Associate II
October 28, 2021

Thank you all for your help