cancel
Showing results for 
Search instead for 
Did you mean: 

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

BSale.1
Associate II
#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

1 ACCEPTED SOLUTION

Accepted Solutions
S.Ma
Principal

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

View solution in original post

5 REPLIES 5
S.Ma
Principal

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
Associate II
  • 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
Guru

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
Principal

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

BSale.1
Associate II

Thank you all for your help