2021-10-18 06:53 AM
#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
Solved! Go to Solution.
2021-10-18 08:09 AM
Even better, meaure vdda through vref adc measurement to have adaptive code.
2021-10-18 06:58 AM
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?
2021-10-18 07:01 AM
2021-10-18 07:10 AM
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.
2021-10-18 08:09 AM
Even better, meaure vdda through vref adc measurement to have adaptive code.
2021-10-28 07:16 AM
Thank you all for your help